Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 46 additions & 1 deletion src/compiler/msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,20 @@ pub fn parse_arguments(
);
}
Some(o) => {
if o.extension().is_none() && compilation {
if o.as_os_str()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry for the latency.
compilation is gone from the check, is that expected?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Np. It is intentional, at least. compilation is checked a bit earlier in this function (l760): this check was always true

.to_string_lossy()
.ends_with(std::path::MAIN_SEPARATOR) {
match Path::new(&input).file_name() {
Some(i) => outputs.insert(
"obj",
ArtifactDescriptor {
path: o.join(Path::new(i)).with_extension("obj"),
optional: false,
},
),
None => cannot_cache!("invalid input file"),
};
} else if o.extension().is_none() {
outputs.insert(
"obj",
ArtifactDescriptor {
Expand Down Expand Up @@ -1833,6 +1846,38 @@ mod test {
assert!(msvc_show_includes);
}

#[test]
fn parse_argument_output_file_trailing_backslash() {
let args = ovec!["-c", "foo.c", "/Fomyrelease\\folder\\"];
let ParsedArguments {
input,
language,
outputs,
preprocessor_args,
msvc_show_includes,
common_args,
..
} = match parse_arguments(args) {
CompilerArguments::Ok(args) => args,
o => panic!("Got unexpected parse result: {:?}", o),
};
assert_eq!(Some("foo.c"), input.to_str());
assert_eq!(Language::C, language);
assert_map_contains!(
outputs,
(
"obj",
ArtifactDescriptor {
path: PathBuf::from("myrelease/folder/foo.obj"),
optional: false
}
)
);
assert!(preprocessor_args.is_empty());
assert!(common_args.is_empty());
assert!(!msvc_show_includes);
}

#[test]
fn test_parse_arguments_pdb() {
let args = ovec!["-c", "foo.c", "-Zi", "-Fdfoo.pdb", "-Fofoo.obj"];
Expand Down