File tree 2 files changed +15
-1
lines changed
2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -725,6 +725,10 @@ impl Build {
725
725
} ,
726
726
) ;
727
727
728
+ if compiler. supports_path_delimiter ( ) {
729
+ cmd. arg ( "--" ) ;
730
+ }
731
+
728
732
cmd. arg ( & src) ;
729
733
730
734
// On MSVC skip the CRT by setting the entry point to `main`.
@@ -1795,14 +1799,16 @@ impl Build {
1795
1799
if is_asm {
1796
1800
cmd. args ( self . asm_flags . iter ( ) . map ( std:: ops:: Deref :: deref) ) ;
1797
1801
}
1798
- if compiler. family == ( ToolFamily :: Msvc { clang_cl : true } ) && !is_assembler_msvc {
1802
+
1803
+ if compiler. supports_path_delimiter ( ) && !is_assembler_msvc {
1799
1804
// #513: For `clang-cl`, separate flags/options from the input file.
1800
1805
// When cross-compiling macOS -> Windows, this avoids interpreting
1801
1806
// common `/Users/...` paths as the `/U` flag and triggering
1802
1807
// `-Wslash-u-filename` warning.
1803
1808
cmd. arg ( "--" ) ;
1804
1809
}
1805
1810
cmd. arg ( & obj. src ) ;
1811
+
1806
1812
if cfg ! ( target_os = "macos" ) {
1807
1813
self . fix_env_for_apple_os ( & mut cmd) ?;
1808
1814
}
Original file line number Diff line number Diff line change @@ -420,6 +420,14 @@ impl Tool {
420
420
pub fn is_like_msvc ( & self ) -> bool {
421
421
matches ! ( self . family, ToolFamily :: Msvc { .. } )
422
422
}
423
+
424
+ /// Supports using `--` delimiter to separate arguments and path to source files.
425
+ pub ( crate ) fn supports_path_delimiter ( & self ) -> bool {
426
+ matches ! (
427
+ self . family,
428
+ ToolFamily :: Clang { .. } | ToolFamily :: Msvc { clang_cl: true }
429
+ )
430
+ }
423
431
}
424
432
425
433
/// Represents the family of tools this tool belongs to.
You can’t perform that action at this time.
0 commit comments