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.

(cherry picked from commit 34421683eb)
This commit is contained in:
Rémi Verschelde 2021-07-15 17:11:15 +02:00
parent 4c79dcc3e7
commit e7f7d5f330
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 5 additions and 1 deletions

View file

@ -431,7 +431,7 @@ if selected_platform in platform_list:
common_warnings += ["-Wno-misleading-indentation"] common_warnings += ["-Wno-misleading-indentation"]
if version[0] >= 7: if version[0] >= 7:
common_warnings += ["-Wshadow-local"] common_warnings += ["-Wshadow-local"]
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"]

View file

@ -840,6 +840,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