SCons: Fix MSVC D9025 warning overriding opt level
And cleanup disable_warnings too to avoid setting `/w` / `-w` multiple times.
This commit is contained in:
parent
52aae6d4f1
commit
9505f5fdd8
24
methods.py
24
methods.py
|
@ -49,17 +49,12 @@ def disable_warnings(self):
|
||||||
if self.msvc:
|
if self.msvc:
|
||||||
# We have to remove existing warning level defines before appending /w,
|
# We have to remove existing warning level defines before appending /w,
|
||||||
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
|
# otherwise we get: "warning D9025 : overriding '/W3' with '/w'"
|
||||||
warn_flags = ["/Wall", "/W4", "/W3", "/W2", "/W1", "/WX"]
|
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
|
||||||
self.Append(CCFLAGS=["/w"])
|
self["CFLAGS"] = [x for x in self["CFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
|
||||||
self.Append(CFLAGS=["/w"])
|
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not (x.startswith("/W") or x.startswith("/w"))]
|
||||||
self.Append(CXXFLAGS=["/w"])
|
self.AppendUnique(CCFLAGS=["/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]
|
|
||||||
else:
|
else:
|
||||||
self.Append(CCFLAGS=["-w"])
|
self.AppendUnique(CCFLAGS=["-w"])
|
||||||
self.Append(CFLAGS=["-w"])
|
|
||||||
self.Append(CXXFLAGS=["-w"])
|
|
||||||
|
|
||||||
|
|
||||||
def force_optimization_on_debug(self):
|
def force_optimization_on_debug(self):
|
||||||
|
@ -68,9 +63,14 @@ def force_optimization_on_debug(self):
|
||||||
return
|
return
|
||||||
|
|
||||||
if self.msvc:
|
if self.msvc:
|
||||||
self.Append(CCFLAGS=["/O2"])
|
# We have to remove existing optimization level defines before appending /O2,
|
||||||
|
# otherwise we get: "warning D9025 : overriding '/0d' with '/02'"
|
||||||
|
self["CCFLAGS"] = [x for x in self["CCFLAGS"] if not x.startswith("/O")]
|
||||||
|
self["CFLAGS"] = [x for x in self["CFLAGS"] if not x.startswith("/O")]
|
||||||
|
self["CXXFLAGS"] = [x for x in self["CXXFLAGS"] if not x.startswith("/O")]
|
||||||
|
self.AppendUnique(CCFLAGS=["/O2"])
|
||||||
else:
|
else:
|
||||||
self.Append(CCFLAGS=["-O3"])
|
self.AppendUnique(CCFLAGS=["-O3"])
|
||||||
|
|
||||||
|
|
||||||
def add_module_version_string(self, s):
|
def add_module_version_string(self, s):
|
||||||
|
|
Loading…
Reference in New Issue