Skip to content

Commit

Permalink
Disable "warnings as errors" flag for CL preprocessing (#2251)
Browse files Browse the repository at this point in the history
  • Loading branch information
AJIOB authored Aug 31, 2024
1 parent 95455ad commit 330d160
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/compiler/msvc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,8 @@ pub fn preprocess_cmd<T>(
}
// Windows SDK generates C4668 during preprocessing, but compiles fine.
// Read for more info: https://github.com/mozilla/sccache/issues/1725
cmd.arg("/wd4668");
// And here: https://github.com/mozilla/sccache/issues/2250
cmd.arg("/WX-");
}

if rewrite_includes_only && is_clang {
Expand Down
8 changes: 8 additions & 0 deletions tests/msvc-preprocessing/foo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ __pragma(warning(disable: 4668))
#endif
__pragma(warning(pop))

// Minimal reproducible example for errors from user code
// More information: https://github.com/mozilla/sccache/issues/2250
#pragma warning(disable : 4002)

#define F(x, y)

int main() {
F(2, , , , , , 3, , , , , , ) // C4002

return 0;
}

0 comments on commit 330d160

Please sign in to comment.