Merge pull request #106118 from akien-mga/scons-gcc-Wenum-conversion

SCons: Don't enable `-Wenum-conversion` for GCC < 11
This commit is contained in:
Thaddeus Crews 2025-05-06 08:37:57 -05:00
commit 0f1b0487a1
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -891,21 +891,24 @@ if env.msvc and not methods.using_clang(env): # MSVC
env.AppendUnique(LINKFLAGS=["/WX"])
else: # GCC, Clang
common_warnings = ["-Wenum-conversion"]
common_warnings = []
if methods.using_gcc(env):
common_warnings += ["-Wshadow", "-Wno-misleading-indentation"]
if cc_version_major < 11:
# Regression in GCC 9/10, spams so much in our variadic templates
# that we need to outright disable it.
common_warnings += ["-Wno-type-limits"]
if cc_version_major >= 12: # False positives in our error macros, see GH-58747.
if cc_version_major == 12:
# Regression in GCC 12, false positives in our error macros, see GH-58747.
common_warnings += ["-Wno-return-type"]
if cc_version_major >= 11:
common_warnings += ["-Wenum-conversion"]
elif methods.using_clang(env) or methods.using_emcc(env):
common_warnings += ["-Wshadow-field-in-constructor", "-Wshadow-uncaptured-local"]
# We often implement `operator<` for structs of pointers as a requirement
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
common_warnings += ["-Wno-ordered-compare-function-pointers"]
common_warnings += ["-Wenum-conversion"]
# clang-cl will interpret `-Wall` as `-Weverything`, workaround with compatibility cast.
env["WARNLEVEL"] = "-Wall" if not env.msvc else "-W3"