From 802399f3fab0820707dc8e562f206594e9a9e1db Mon Sep 17 00:00:00 2001 From: pashokitsme Date: Mon, 18 Dec 2023 16:14:48 +0300 Subject: [PATCH] Add `--` for files in `try_expand` (like in #514) (#911) * fix * format --- src/lib.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 24329e9dc..699facfea 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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 { + // #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