File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1311,6 +1311,13 @@ impl Build {
13111311 if self . cuda && self . files . len ( ) > 1 {
13121312 cmd. arg ( "--device-c" ) ;
13131313 }
1314+ if compiler. family == ( ToolFamily :: Msvc { clang_cl : true } ) {
1315+ // #513: For `clang-cl`, separate flags/options from the input file.
1316+ // When cross-compiling macOS -> Windows, this avoids interpreting
1317+ // common `/Users/...` paths as the `/U` flag and triggering
1318+ // `-Wslash-u-filename` warning.
1319+ cmd. arg ( "--" ) ;
1320+ }
13141321 cmd. arg ( & obj. src ) ;
13151322 if cfg ! ( target_os = "macos" ) {
13161323 self . fix_env_for_apple_os ( & mut cmd) ?;
Original file line number Diff line number Diff line change @@ -343,6 +343,14 @@ fn gnu_static() {
343343 test. cmd ( 0 ) . must_have ( "-static" ) . must_not_have ( "-shared" ) ;
344344}
345345
346+ #[ test]
347+ fn gnu_no_dash_dash ( ) {
348+ let test = Test :: gnu ( ) ;
349+ test. gcc ( ) . file ( "foo.c" ) . compile ( "foo" ) ;
350+
351+ test. cmd ( 0 ) . must_not_have ( "--" ) ;
352+ }
353+
346354#[ test]
347355fn msvc_smoke ( ) {
348356 reset_env ( ) ;
@@ -411,3 +419,11 @@ fn msvc_no_static_crt() {
411419
412420 test. cmd ( 0 ) . must_have ( "-MD" ) ;
413421}
422+
423+ #[ test]
424+ fn msvc_no_dash_dash ( ) {
425+ let test = Test :: msvc ( ) ;
426+ test. gcc ( ) . file ( "foo.c" ) . compile ( "foo" ) ;
427+
428+ test. cmd ( 0 ) . must_not_have ( "--" ) ;
429+ }
You can’t perform that action at this time.
0 commit comments