1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Replace FALLTHROUGH macro by C++17 [[fallthrough]]

This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
This commit is contained in:
Rémi Verschelde
2020-02-22 20:47:50 +01:00
parent a7891b9d12
commit 2cf6ac6c50
25 changed files with 75 additions and 88 deletions

View File

@@ -360,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'])
@@ -374,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'):