Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -- for files in try_expand (like in #514) #911

Merged
merged 2 commits into from
Dec 18, 2023
Merged
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
15 changes: 15 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,21 @@ impl Build {
"Expand may only be called for a single file"
);

let is_asm = self
.files
.iter()
.map(std::ops::Deref::deref)
.find_map(AsmFileExt::from_path)
.is_some();

if compiler.family == (ToolFamily::Msvc { clang_cl: true }) && !is_asm {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry but I do wonder why !is_asm is needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't 100% sure its needed. But since !is_asm is added in PR #747 (continuation of #514?), so i added it here too.

Copy link
Collaborator

Choose a reason for hiding this comment

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

#747 uses is_assembler_msvc instead of just. is_assembler though:

let msvc = target.contains("msvc");
let is_assembler_msvc = msvc && asm_ext == Some(AsmFileExt::DotAsm);

So it will add -- as long as the target is not msvc, not sure which version is better.

IMO if compiler.family is msvc clang-ci then it's probably a MSVC target.

// #513: For `clang-cl`, separate flags/options from the input file.
// When cross-compiling macOS -> Windows, this avoids interpreting
// common `/Users/...` paths as the `/U` flag and triggering
// `-Wslash-u-filename` warning.
cmd.arg("--");
}

cmd.args(self.files.iter().map(std::ops::Deref::deref));

let name = compiler
Expand Down