Skip to content

Commit

Permalink
fix msvc passthrough arguments
Browse files Browse the repository at this point in the history
mozilla#764 and its followon patch, mozilla#768, failed to take into account that
passthrough arguments actually need to be passed through to the compiler
invocation: they don't prevent caching, but they do need to be
considered when computing the cache key...and when actually performing
the compilation.
  • Loading branch information
froydnj committed Jun 24, 2020
1 parent 9a7ec04 commit e3047d3
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/compiler/msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,12 @@ pub fn parse_arguments(
arg.normalize(NormalizedDisposition::Concatenated)
.iter_os_strings(),
),
Some(PassThrough) | Some(PassThroughWithPath(_)) | Some(PassThroughWithSuffix(_)) => {
common_args.extend(
arg.normalize(NormalizedDisposition::Concatenated)
.iter_os_strings(),
)
}
_ => {}
}
}
Expand Down Expand Up @@ -1086,6 +1092,37 @@ mod test {
);
}

#[test]
fn test_parse_arguments_passthrough() {
let args = ovec![
"-Oy",
"-Gw",
"-EHa",
"-Fmdictionary-map",
"-c",
"-Fohost_dictionary.obj",
"dictionary.c"
];
let ParsedArguments {
input,
common_args,
dependency_args,
preprocessor_args,
..
} = match parse_arguments(args) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
assert_eq!(Some("dictionary.c"), input.to_str());
assert!(preprocessor_args.is_empty());
assert!(dependency_args.is_empty());
assert!(!common_args.is_empty());
assert_eq!(
common_args,
ovec!("-Oy", "-Gw", "-EHa", "-Fmdictionary-map")
);
}

#[test]
fn test_parse_arguments_too_many_inputs() {
assert_eq!(
Expand Down

0 comments on commit e3047d3

Please sign in to comment.