Merge pull request #26161 from marxin/add-Wwrite-strings

Add -Wwrite-strings into all and extra warnings.
This commit is contained in:
Hein-Pieter van Braam 2019-02-25 00:50:39 +01:00 committed by GitHub
commit 3d5fc1bb38
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -337,17 +337,18 @@ if selected_platform in platform_list:
else: # Rest of the world
disable_nonessential_warnings = ['-Wno-sign-compare']
shadow_local_warning = []
all_plus_warnings = ['-Wwrite-strings']
if 'gcc' in os.path.basename(env["CC"]):
version = methods.get_compiler_version(env)
if version != None and version[0] >= '7':
shadow_local_warning = ['-Wshadow-local']
if (env["warnings"] == 'extra'):
env.Append(CCFLAGS=['-Wall', '-Wextra'] + shadow_local_warning)
env.Append(CCFLAGS=['-Wall', '-Wextra'] + all_plus_warnings + shadow_local_warning)
elif (env["warnings"] == 'all'):
env.Append(CCFLAGS=['-Wall'] + shadow_local_warning + disable_nonessential_warnings)
env.Append(CCFLAGS=['-Wall'] + all_plus_warnings + shadow_local_warning + disable_nonessential_warnings)
elif (env["warnings"] == 'moderate'):
env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning + disable_nonessential_warnings)
env.Append(CCFLAGS=['-Wall', '-Wno-unused'] + shadow_local_warning + disable_nonessential_warnings)
else: # 'no'
env.Append(CCFLAGS=['-w'])
if (env["werror"]):