summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-10-08 10:49:33 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-10-08 10:58:05 +0200
commit97f116d36bdc8a335f26eebb70a7480d96536ecb (patch)
treeb894b3d56ba1d6f2cf6532698d5a057142e5e22c /SConstruct
parent8a4f402bcb85ccbf713b76581a1960448f917695 (diff)
SCons: Refactor and cleanup warnings definition
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct23
1 files changed, 10 insertions, 13 deletions
diff --git a/SConstruct b/SConstruct
index e38e0dc231..f134dfddac 100644
--- a/SConstruct
+++ b/SConstruct
@@ -414,7 +414,7 @@ if selected_platform in platform_list:
Exit(255)
# Configure compiler warnings
- if env.msvc:
+ if env.msvc: # MSVC
# Truncations, narrowing conversions, signed/unsigned comparisons...
disable_nonessential_warnings = ["/wd4267", "/wd4244", "/wd4305", "/wd4018", "/wd4800"]
if env["warnings"] == "extra":
@@ -427,21 +427,17 @@ if selected_platform in platform_list:
env.Append(CCFLAGS=["/w"])
# Set exception handling model to avoid warnings caused by Windows system headers.
env.Append(CCFLAGS=["/EHsc"])
+
if env["werror"]:
env.Append(CCFLAGS=["/WX"])
- # Force to use Unicode encoding
- env.Append(MSVC_FLAGS=["/utf8"])
- else: # Rest of the world
- shadow_local_warning = []
- all_plus_warnings = ["-Wwrite-strings"]
+ else: # GCC, Clang
+ gcc_common_warnings = []
if methods.using_gcc(env):
- env.Append(CCFLAGS=["-Wno-misleading-indentation"])
- if cc_version_major >= 7:
- shadow_local_warning = ["-Wshadow-local"]
+ gcc_common_warnings += ["-Wshadow-local", "-Wno-misleading-indentation"]
if env["warnings"] == "extra":
- env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wno-unused-parameter"] + all_plus_warnings + shadow_local_warning)
+ env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + gcc_common_warnings)
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
if methods.using_gcc(env):
env.Append(
@@ -457,14 +453,15 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=["-Wplacement-new=1"])
if cc_version_major >= 9:
env.Append(CCFLAGS=["-Wattribute-alias=2"])
- if methods.using_clang(env):
+ elif methods.using_clang(env):
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
elif env["warnings"] == "all":
- env.Append(CCFLAGS=["-Wall"] + shadow_local_warning)
+ env.Append(CCFLAGS=["-Wall"] + gcc_common_warnings)
elif env["warnings"] == "moderate":
- env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + shadow_local_warning)
+ env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + gcc_common_warnings)
else: # 'no'
env.Append(CCFLAGS=["-w"])
+
if env["werror"]:
env.Append(CCFLAGS=["-Werror"])
# FIXME: Temporary workaround after the Vulkan merge, remove once warnings are fixed.