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 Jul 1, 2020
1 parent 9a7ec04 commit 569bfc5
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion src/compiler/msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,11 @@ pub fn parse_arguments(
arg.normalize(NormalizedDisposition::Concatenated)
.iter_os_strings(),
),
Some(ProgramDatabase(_)) | Some(DebugInfo) => common_args.extend(
Some(ProgramDatabase(_))
| Some(DebugInfo)
| Some(PassThrough)
| Some(PassThroughWithPath(_))
| Some(PassThroughWithSuffix(_)) => common_args.extend(
arg.normalize(NormalizedDisposition::Concatenated)
.iter_os_strings(),
),
Expand Down Expand Up @@ -1086,6 +1090,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 569bfc5

Please sign in to comment.