SCons: Add method to detect Emscripten and use it for warnings config
Emscripten is LLVM-based so we want to follow the same logic. But we can't just put it as a match in `methods.using_clang()` as that would mess with the compiler version detection logic used to restrict old GCC and Clang releases.
This commit is contained in:
parent
802810c371
commit
34421683eb
|
@ -510,7 +510,7 @@ if selected_platform in platform_list:
|
||||||
|
|
||||||
if methods.using_gcc(env):
|
if methods.using_gcc(env):
|
||||||
common_warnings += ["-Wshadow-local", "-Wno-misleading-indentation"]
|
common_warnings += ["-Wshadow-local", "-Wno-misleading-indentation"]
|
||||||
elif methods.using_clang(env):
|
elif methods.using_clang(env) or methods.using_emcc(env):
|
||||||
# We often implement `operator<` for structs of pointers as a requirement
|
# 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.
|
# for putting them in `Set` or `Map`. We don't mind about unreliable ordering.
|
||||||
common_warnings += ["-Wno-ordered-compare-function-pointers"]
|
common_warnings += ["-Wno-ordered-compare-function-pointers"]
|
||||||
|
@ -532,7 +532,7 @@ if selected_platform in platform_list:
|
||||||
env.Append(CXXFLAGS=["-Wplacement-new=1"])
|
env.Append(CXXFLAGS=["-Wplacement-new=1"])
|
||||||
if cc_version_major >= 9:
|
if cc_version_major >= 9:
|
||||||
env.Append(CCFLAGS=["-Wattribute-alias=2"])
|
env.Append(CCFLAGS=["-Wattribute-alias=2"])
|
||||||
elif methods.using_clang(env):
|
elif methods.using_clang(env) or methods.using_emcc(env):
|
||||||
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
|
env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
|
||||||
elif env["warnings"] == "all":
|
elif env["warnings"] == "all":
|
||||||
env.Append(CCFLAGS=["-Wall"] + common_warnings)
|
env.Append(CCFLAGS=["-Wall"] + common_warnings)
|
||||||
|
@ -548,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"])
|
||||||
elif methods.using_clang(env):
|
elif methods.using_clang(env) or methods.using_emcc(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"])
|
||||||
|
|
|
@ -828,6 +828,10 @@ def using_clang(env):
|
||||||
return "clang" in os.path.basename(env["CC"])
|
return "clang" in os.path.basename(env["CC"])
|
||||||
|
|
||||||
|
|
||||||
|
def using_emcc(env):
|
||||||
|
return "emcc" in os.path.basename(env["CC"])
|
||||||
|
|
||||||
|
|
||||||
def show_progress(env):
|
def show_progress(env):
|
||||||
import sys
|
import sys
|
||||||
from SCons.Script import Progress, Command, AlwaysBuild
|
from SCons.Script import Progress, Command, AlwaysBuild
|
||||||
|
|
Loading…
Reference in New Issue