From db1e17a3cda7892171f39c36cb20b19329aecaa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 27 Sep 2022 12:35:12 +0200 Subject: [PATCH] SCons: Fix MSVC D9025 warning overriding opt level And cleanup disable_warnings too to avoid setting `/w` / `-w` multiple times. (cherry picked from commit 9505f5fdd8ccc8954db874d0457d98c30bfed100) --- methods.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/methods.py b/methods.py index 436fe63f6a6..012bbd8305a 100644 --- a/methods.py +++ b/methods.py @@ -46,17 +46,12 @@ def disable_warnings(self): if self.msvc: # We have to remove existing warning level defines before appending /w, # otherwise we get: "warning D9025 : overriding '/W3' with '/w'" - warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"] - self.Append(CCFLAGS=["/w"]) - self.Append(CFLAGS=["/w"]) - self.Append(CXXFLAGS=["/w"]) - self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x in warn_flags] - self["CFLAGS"] = [x for x in self["CFLAGS"] if not x in warn_flags] - self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x in warn_flags] + 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"))] + self.AppendUnique(CCFLAGS=["/w"]) else: - self.Append(CCFLAGS=["-w"]) - self.Append(CFLAGS=["-w"]) - self.Append(CXXFLAGS=["-w"]) + self.AppendUnique(CCFLAGS=["-w"]) def add_module_version_string(self, s):