Skip to content

Commit 330d160

Browse files
authored
Disable "warnings as errors" flag for CL preprocessing (#2251)
1 parent 95455ad commit 330d160

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/compiler/msvc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,8 @@ pub fn preprocess_cmd<T>(
908908
}
909909
// Windows SDK generates C4668 during preprocessing, but compiles fine.
910910
// Read for more info: https://github.com/mozilla/sccache/issues/1725
911-
cmd.arg("/wd4668");
911+
// And here: https://github.com/mozilla/sccache/issues/2250
912+
cmd.arg("/WX-");
912913
}
913914

914915
if rewrite_includes_only && is_clang {

tests/msvc-preprocessing/foo.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ __pragma(warning(disable: 4668))
1010
#endif
1111
__pragma(warning(pop))
1212

13+
// Minimal reproducible example for errors from user code
14+
// More information: https://github.com/mozilla/sccache/issues/2250
15+
#pragma warning(disable : 4002)
16+
17+
#define F(x, y)
18+
1319
int main() {
20+
F(2, , , , , , 3, , , , , , ) // C4002
21+
1422
return 0;
1523
}

0 commit comments

Comments
 (0)