From f09ffeedd0e28cb58093f66f20580bf2f1d6b1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Tue, 6 May 2025 10:05:09 +0200 Subject: [PATCH] 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. --- SConstruct | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SConstruct b/SConstruct index e895cffdab..ce49308d10 100644 --- a/SConstruct +++ b/SConstruct @@ -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"