SCons: Fix MSVC bypassing disabled warnings

This commit is contained in:
Thaddeus Crews 2024-12-08 15:58:14 -06:00
parent aa8d9b83f6
commit 070aeb5688
No known key found for this signature in database
GPG key ID: 62181B86FE9E5D84
7 changed files with 55 additions and 67 deletions

View file

@ -130,9 +130,10 @@ def disable_warnings(self):
if self.msvc and not using_clang(self):
# We have to remove existing warning level defines before appending /w,
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
self["CFLAGS"] = [x for x in self["CFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
WARN_FLAGS = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/W0"]
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if x not in WARN_FLAGS]
self["CFLAGS"] = [x for x in self["CFLAGS"] if x not in WARN_FLAGS]
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if x not in WARN_FLAGS]
self.AppendUnique(CCFLAGS=["/w"])
else:
self.AppendUnique(CCFLAGS=["-w"])