SCons: Disable Clang -Wordered-compare-function-pointers warning
It's raised for us on many comparators implemented to be able to store a struct in `Set` or `Map` (who rely on `operator<` internally). In the cases I reviewed we don't actually care about the ordering and we use the struct's function pointers as that's the only distinctive data available.
This commit is contained in:
parent
9f4e9ad75c
commit
802810c371
16
SConstruct
16
SConstruct
|
@ -506,13 +506,17 @@ if selected_platform in platform_list:
|
||||||
if env["werror"]:
|
if env["werror"]:
|
||||||
env.Append(CCFLAGS=["/WX"])
|
env.Append(CCFLAGS=["/WX"])
|
||||||
else: # GCC, Clang
|
else: # GCC, Clang
|
||||||
gcc_common_warnings = []
|
common_warnings = []
|
||||||
|
|
||||||
if methods.using_gcc(env):
|
if methods.using_gcc(env):
|
||||||
gcc_common_warnings += ["-Wshadow-local", "-Wno-misleading-indentation"]
|
common_warnings += ["-Wshadow-local", "-Wno-misleading-indentation"]
|
||||||
|
elif methods.using_clang(env):
|
||||||
|
# We often implement `operator<` for structs of pointers as a requirement
|
||||||
|
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
|
||||||
|
common_warnings += ["-Wno-ordered-compare-function-pointers"]
|
||||||
|
|
||||||
if env["warnings"] == "extra":
|
if env["warnings"] == "extra":
|
||||||
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + gcc_common_warnings)
|
env.Append(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + common_warnings)
|
||||||
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
|
env.Append(CXXFLAGS=["-Wctor-dtor-privacy", "-Wnon-virtual-dtor"])
|
||||||
if methods.using_gcc(env):
|
if methods.using_gcc(env):
|
||||||
env.Append(
|
env.Append(
|
||||||
|
@ -531,9 +535,9 @@ if selected_platform in platform_list:
|
||||||
elif methods.using_clang(env):
|
elif methods.using_clang(env):
|
||||||
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
|
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
|
||||||
elif env["warnings"] == "all":
|
elif env["warnings"] == "all":
|
||||||
env.Append(CCFLAGS=["-Wall"] + gcc_common_warnings)
|
env.Append(CCFLAGS=["-Wall"] + common_warnings)
|
||||||
elif env["warnings"] == "moderate":
|
elif env["warnings"] == "moderate":
|
||||||
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + gcc_common_warnings)
|
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + common_warnings)
|
||||||
else: # 'no'
|
else: # 'no'
|
||||||
env.Append(CCFLAGS=["-w"])
|
env.Append(CCFLAGS=["-w"])
|
||||||
|
|
||||||
|
@ -544,7 +548,7 @@ if selected_platform in platform_list:
|
||||||
env.Append(CXXFLAGS=["-Wno-error=cpp"])
|
env.Append(CXXFLAGS=["-Wno-error=cpp"])
|
||||||
if cc_version_major == 7: # Bogus warning fixed in 8+.
|
if cc_version_major == 7: # Bogus warning fixed in 8+.
|
||||||
env.Append(CCFLAGS=["-Wno-error=strict-overflow"])
|
env.Append(CCFLAGS=["-Wno-error=strict-overflow"])
|
||||||
else:
|
elif methods.using_clang(env):
|
||||||
env.Append(CXXFLAGS=["-Wno-error=#warnings"])
|
env.Append(CXXFLAGS=["-Wno-error=#warnings"])
|
||||||
else: # always enable those errors
|
else: # always enable those errors
|
||||||
env.Append(CCFLAGS=["-Werror=return-type"])
|
env.Append(CCFLAGS=["-Werror=return-type"])
|
||||||
|
|
Loading…
Reference in New Issue