summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct22
1 files changed, 17 insertions, 5 deletions
diff --git a/SConstruct b/SConstruct
index fe6178d670..e20499a756 100644
--- a/SConstruct
+++ b/SConstruct
@@ -292,6 +292,7 @@ if selected_platform in platform_list:
if env["extra_suffix"] != '':
env.extra_suffix += '.' + env["extra_suffix"]
+ # Environment flags
CCFLAGS = env.get('CCFLAGS', '')
env['CCFLAGS'] = ''
env.Append(CCFLAGS=str(CCFLAGS).split())
@@ -308,17 +309,28 @@ if selected_platform in platform_list:
env['LINKFLAGS'] = ''
env.Append(LINKFLAGS=str(LINKFLAGS).split())
+ # Platform specific flags
flag_list = platform_flags[selected_platform]
for f in flag_list:
if not (f[0] in ARGUMENTS): # allow command line to override platform flags
env[f[0]] = f[1]
- # must happen after the flags, so when flags are used by configure, stuff happens (ie, ssl on x11)
+ # Must happen after the flags definition, so that they can be used by platform detect
detect.configure(env)
- # Enable C++11 support
+ # Set our C and C++ standard requirements.
+ # C++17 is required as we need guaranteed copy elision as per GH-36436.
+ # Prepending to make it possible to override.
+ # This needs to come after `configure`, otherwise we don't have env.msvc.
if not env.msvc:
- env.Append(CXXFLAGS=['-std=c++11'])
+ # Specifying GNU extensions support explicitly, which are supported by
+ # both GCC and Clang. Both currently default to gnu11 and gnu++14.
+ env.Prepend(CFLAGS=['-std=gnu11'])
+ env.Prepend(CXXFLAGS=['-std=gnu++17'])
+ else:
+ # MSVC doesn't have clear C standard support, /std only covers C++.
+ # We apply it to CCFLAGS (both C and C++ code) in case it impacts C features.
+ env.Prepend(CCFLAGS=['/std:c++17', '/permissive-'])
# Configure compiler warnings
if env.msvc:
@@ -348,8 +360,6 @@ if selected_platform in platform_list:
shadow_local_warning = ['-Wshadow-local']
if (env["warnings"] == 'extra'):
- # Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
- # once we switch to C++11 or later (necessary for our FALLTHROUGH macro).
env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-unused-parameter']
+ all_plus_warnings + shadow_local_warning)
env.Append(CXXFLAGS=['-Wctor-dtor-privacy', '-Wnon-virtual-dtor'])
@@ -362,6 +372,8 @@ if selected_platform in platform_list:
version = methods.get_compiler_version(env)
if version != None and version[0] >= '9':
env.Append(CCFLAGS=['-Wattribute-alias=2'])
+ if methods.using_clang(env):
+ env.Append(CCFLAGS=['-Wimplicit-fallthrough'])
elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['-Wall'] + shadow_local_warning)
elif (env["warnings"] == 'moderate'):