Repository: mozilla/sccache (language: python)

Issue:
MSVC: preprocessing is failed while compiling is success
Minimal reproducible example:

```cpp
#pragma warning(disable : 4002)

// C4002b.cpp
// compile with: /W1 /WX
#define F(x, y)

int main()
{
    F(2, , , , , , 3, , , , , , ) // C4002
    // Try the following line instead:
    // F(2,3)

    return 0;
}
```

Tested with MSVC 2017, 2022.

The problem is that sccache without direct mode doesn't remove `/WX` flag when adding `/EP` one.


Discussion / hints:
Just a note: our big project disables some different warnings in per-file or per-region manner because of the different reasons.

And this code compiles & works, similar to the #1725.

So, I suggest to just disable `/WX` flag (interpret warnings as errors) for removing incorrect cache tool errors 

Fix patch:
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<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 {


Test patch:
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;
 }