SCons: Don't enable -Wenum-conversion for GCC < 11

This warning was introduced in GCC 10 but only for C/Obj-C.
In GCC 11 it seems to have been made compatible with C++.

Also restrict -Wno-return-type to GCC 12, that regression
was fixed in GCC 13.
This commit is contained in:
Rémi Verschelde 2025-05-06 10:05:09 +02:00
parent 1a1cc0f7b0
commit f09ffeedd0
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

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