Skip to content

Commit

Permalink
Fix compiler family detection issue with clang-cl on macOS
Browse files Browse the repository at this point in the history
Fixed #1327
  • Loading branch information
NobodyXu authored Dec 22, 2024
1 parent 9138052 commit 501f819
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,17 @@ impl Tool {
tmp_file.sync_data()?;
drop(tmp_file);

let mut cmd = Command::new(path);
cmd.arg("-E");
if compiler.family == (ToolFamily::Msvc { clang_cl: true }) {
// #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("--");
}
let stdout = run_output(
Command::new(path).arg("-E").arg(tmp.path()),
cmd.arg(tmp.path()),
path,
// When expanding the file, the compiler prints a lot of information to stderr
// that it is not an error, but related to expanding itself.
Expand Down

0 comments on commit 501f819

Please sign in to comment.