From 72ea74bcc15e4a53f74e217ece0eea6d7aed04ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 27 Mar 2020 16:04:26 +0100 Subject: [PATCH] SCons: Treat all warnings as errors After an effort spanning several years, we should now be warning-free on all major compilers, so we can set `-Werror` to ensure that we don't introduce warnings in new code. Disable -Werror=strict-overflow on GCC 7 though, as it seems bogus and was fixed in 8+. --- SConstruct | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SConstruct b/SConstruct index 693137f77f8..373fd098af9 100644 --- a/SConstruct +++ b/SConstruct @@ -126,7 +126,7 @@ opts.Add(BoolVariable("xaudio2", "Enable the XAudio2 audio driver", False)) opts.Add(BoolVariable("verbose", "Enable verbose output for the compilation", False)) opts.Add(BoolVariable("progress", "Show a progress indicator during compilation", True)) opts.Add(EnumVariable("warnings", "Level of compilation warnings", "all", ("extra", "all", "moderate", "no"))) -opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", False)) +opts.Add(BoolVariable("werror", "Treat compiler warnings as errors", True)) opts.Add(BoolVariable("dev", "If yes, alias for verbose=yes warnings=extra werror=yes", False)) opts.Add("extra_suffix", "Custom extra suffix added to the base filename of all generated binary files", "") opts.Add(BoolVariable("vsproj", "Generate a Visual Studio solution", False)) @@ -448,6 +448,8 @@ if selected_platform in platform_list: # FIXME: Temporary workaround after the Vulkan merge, remove once warnings are fixed. if methods.using_gcc(env): env.Append(CXXFLAGS=["-Wno-error=cpp"]) + if cc_version_major == 7: # Bogus warning fixed in 8+. + env.Append(CCFLAGS=["-Wno-error=strict-overflow"]) else: env.Append(CXXFLAGS=["-Wno-error=#warnings"]) else: # always enable those errors