Skip to content

Commit 6e800fe

Browse files
committed
Fix compiler family detection issue with clang-cl on macOS
Fixed #1327
1 parent 18307cf commit 6e800fe

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/tool.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,17 @@ impl Tool {
140140
tmp_file.sync_data()?;
141141
drop(tmp_file);
142142

143+
let mut cmd = Command::new(path);
144+
cmd.arg("-E");
145+
if compiler.family == (ToolFamily::Msvc { clang_cl: true }) {
146+
// #513: For `clang-cl`, separate flags/options from the input file.
147+
// When cross-compiling macOS -> Windows, this avoids interpreting
148+
// common `/Users/...` paths as the `/U` flag and triggering
149+
// `-Wslash-u-filename` warning.
150+
cmd.arg("--");
151+
}
143152
let stdout = run_output(
144-
Command::new(path).arg("-E").arg(tmp.path()),
153+
cmd.arg(tmp.path()),
145154
path,
146155
// When expanding the file, the compiler prints a lot of information to stderr
147156
// that it is not an error, but related to expanding itself.

0 commit comments

Comments
 (0)