From 07545b00634ee8157ef59ed68d699284ffcbef91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 30 Apr 2022 12:06:59 +0200 Subject: [PATCH] SCons: Disable `-Werror=return-type` for GCC 12+ due to regression Works around and thus closes #58747. Supersedes #60613. (cherry picked from commit 01f8f17b67eb3ebbde5489eb6ee96d332e368d14) --- SConstruct | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index cc37f3d5e3c..ce1de2b5a2d 100644 --- a/SConstruct +++ b/SConstruct @@ -502,8 +502,12 @@ if selected_platform in platform_list: if env["werror"]: env.Append(CCFLAGS=["-Werror"]) - else: # always enable those errors - env.Append(CCFLAGS=["-Werror=return-type"]) + if methods.using_gcc(env) and version[0] >= 12: # False positives in our error macros, see GH-58747. + env.Append(CCFLAGS=["-Wno-error=return-type"]) + else: # Always enable those errors. + # False positives in our error macros, see GH-58747. + if not (methods.using_gcc(env) and version[0] >= 12): + env.Append(CCFLAGS=["-Werror=return-type"]) if hasattr(detect, "get_program_suffix"): suffix = "." + detect.get_program_suffix()