diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-05 14:06:16 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-05 15:14:53 +0200 |
commit | fc370b3feb419fdc1a8139bdf01f1dacf868ca1f (patch) | |
tree | 9d7409482045aeaee31994ed6ae5b00f7fd1a4db /SConstruct | |
parent | e4a96164b6e52dac6aff7ddad05bd3ed735840a9 (diff) | |
download | redot-engine-fc370b3feb419fdc1a8139bdf01f1dacf868ca1f.tar.gz |
Fix -Wimplicit-fallthrough warnings from GCC 8
Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.
The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.
Fixes #26135.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/SConstruct b/SConstruct index 4a97cb9407..1271156a28 100644 --- a/SConstruct +++ b/SConstruct @@ -346,13 +346,14 @@ if selected_platform in platform_list: version = methods.get_compiler_version(env) if version != None and version[0] >= '7': shadow_local_warning = ['-Wshadow-local'] + if (env["warnings"] == 'extra'): - # FIXME: enable -Wimplicit-fallthrough once #26135 is fixed # FIXME: enable -Wclobbered once #26351 is fixed - env.Append(CCFLAGS=['-Wall', '-Wextra', '-Wno-implicit-fallthrough', '-Wno-unused-parameter'] + all_plus_warnings + shadow_local_warning) + # 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) if methods.using_gcc(env): env['CCFLAGS'] += ['-Wno-clobbered'] - elif (env["warnings"] == 'all'): env.Append(CCFLAGS=['-Wall'] + shadow_local_warning) elif (env["warnings"] == 'moderate'): |