From e2d1eaf07aa230413f87bcbec6091cc0cbea0086 Mon Sep 17 00:00:00 2001 From: AJIOB Date: Sat, 31 Aug 2024 14:39:43 +0300 Subject: [PATCH] Disable "warnings as errors" flag for CL preprocessing --- src/compiler/msvc.rs | 3 ++- tests/msvc-preprocessing/foo.cpp | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/compiler/msvc.rs b/src/compiler/msvc.rs index ccf77ce75..b9b797888 100644 --- a/src/compiler/msvc.rs +++ b/src/compiler/msvc.rs @@ -908,7 +908,8 @@ pub fn preprocess_cmd( } // 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 { diff --git a/tests/msvc-preprocessing/foo.cpp b/tests/msvc-preprocessing/foo.cpp index e0604526f..511b0a75d 100644 --- a/tests/msvc-preprocessing/foo.cpp +++ b/tests/msvc-preprocessing/foo.cpp @@ -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; }