You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
SCons: Refactor and cleanup warnings definition
(cherry picked from commits97f116d36band56f3aba7b2)
This commit is contained in:
21
SConstruct
21
SConstruct
@@ -362,7 +362,7 @@ if selected_platform in platform_list:
|
|||||||
env.Prepend(CCFLAGS=["/std:c++14"])
|
env.Prepend(CCFLAGS=["/std:c++14"])
|
||||||
|
|
||||||
# Configure compiler warnings
|
# Configure compiler warnings
|
||||||
if env.msvc:
|
if env.msvc: # MSVC
|
||||||
# Truncations, narrowing conversions, signed/unsigned comparisons...
|
# Truncations, narrowing conversions, signed/unsigned comparisons...
|
||||||
disable_nonessential_warnings = ["/wd4267", "/wd4244", "/wd4305", "/wd4018", "/wd4800"]
|
disable_nonessential_warnings = ["/wd4267", "/wd4244", "/wd4305", "/wd4018", "/wd4800"]
|
||||||
if env["warnings"] == "extra":
|
if env["warnings"] == "extra":
|
||||||
@@ -375,25 +375,23 @@ if selected_platform in platform_list:
|
|||||||
env.Append(CCFLAGS=["/w"])
|
env.Append(CCFLAGS=["/w"])
|
||||||
# Set exception handling model to avoid warnings caused by Windows system headers.
|
# Set exception handling model to avoid warnings caused by Windows system headers.
|
||||||
env.Append(CCFLAGS=["/EHsc"])
|
env.Append(CCFLAGS=["/EHsc"])
|
||||||
|
|
||||||
if env["werror"]:
|
if env["werror"]:
|
||||||
env.Append(CCFLAGS=["/WX"])
|
env.Append(CCFLAGS=["/WX"])
|
||||||
# Force to use Unicode encoding
|
else: # GCC, Clang
|
||||||
env.Append(MSVC_FLAGS=["/utf8"])
|
|
||||||
else: # Rest of the world
|
|
||||||
version = methods.get_compiler_version(env) or [-1, -1]
|
version = methods.get_compiler_version(env) or [-1, -1]
|
||||||
|
|
||||||
shadow_local_warning = []
|
gcc_common_warnings = []
|
||||||
all_plus_warnings = ["-Wwrite-strings"]
|
|
||||||
|
|
||||||
if methods.using_gcc(env):
|
if methods.using_gcc(env):
|
||||||
env.Append(CCFLAGS=["-Wno-misleading-indentation"])
|
gcc_common_warnings += ["-Wno-misleading-indentation"]
|
||||||
if version[0] >= 7:
|
if version[0] >= 7:
|
||||||
shadow_local_warning = ["-Wshadow-local"]
|
gcc_common_warnings += ["-Wshadow-local"]
|
||||||
|
|
||||||
if env["warnings"] == "extra":
|
if env["warnings"] == "extra":
|
||||||
# Note: enable -Wimplicit-fallthrough for Clang (already part of -Wextra for GCC)
|
# 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).
|
# 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(CCFLAGS=["-Wall", "-Wextra", "-Wwrite-strings", "-Wno-unused-parameter"] + gcc_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(
|
||||||
@@ -409,11 +407,12 @@ if selected_platform in platform_list:
|
|||||||
if version[0] >= 9:
|
if version[0] >= 9:
|
||||||
env.Append(CCFLAGS=["-Wattribute-alias=2"])
|
env.Append(CCFLAGS=["-Wattribute-alias=2"])
|
||||||
elif env["warnings"] == "all":
|
elif env["warnings"] == "all":
|
||||||
env.Append(CCFLAGS=["-Wall"] + shadow_local_warning)
|
env.Append(CCFLAGS=["-Wall"] + gcc_common_warnings)
|
||||||
elif env["warnings"] == "moderate":
|
elif env["warnings"] == "moderate":
|
||||||
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + shadow_local_warning)
|
env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + gcc_common_warnings)
|
||||||
else: # 'no'
|
else: # 'no'
|
||||||
env.Append(CCFLAGS=["-w"])
|
env.Append(CCFLAGS=["-w"])
|
||||||
|
|
||||||
if env["werror"]:
|
if env["werror"]:
|
||||||
env.Append(CCFLAGS=["-Werror"])
|
env.Append(CCFLAGS=["-Werror"])
|
||||||
else: # always enable those errors
|
else: # always enable those errors
|
||||||
|
|||||||
@@ -78,6 +78,9 @@ def configure(env):
|
|||||||
env["ENV"] = os.environ
|
env["ENV"] = os.environ
|
||||||
vc_base_path = os.environ["VCTOOLSINSTALLDIR"] if "VCTOOLSINSTALLDIR" in os.environ else os.environ["VCINSTALLDIR"]
|
vc_base_path = os.environ["VCTOOLSINSTALLDIR"] if "VCTOOLSINSTALLDIR" in os.environ else os.environ["VCINSTALLDIR"]
|
||||||
|
|
||||||
|
# Force to use Unicode encoding
|
||||||
|
env.AppendUnique(CCFLAGS=["/utf-8"])
|
||||||
|
|
||||||
# ANGLE
|
# ANGLE
|
||||||
angle_root = os.getenv("ANGLE_SRC_PATH")
|
angle_root = os.getenv("ANGLE_SRC_PATH")
|
||||||
env.Prepend(CPPPATH=[angle_root + "/include"])
|
env.Prepend(CPPPATH=[angle_root + "/include"])
|
||||||
|
|||||||
@@ -209,8 +209,8 @@ def configure_msvc(env, manual_msvc_config):
|
|||||||
## Compile/link flags
|
## Compile/link flags
|
||||||
|
|
||||||
env.AppendUnique(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"])
|
env.AppendUnique(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"])
|
||||||
if int(env["MSVC_VERSION"].split(".")[0]) >= 14: # vs2015 and later
|
# Force to use Unicode encoding
|
||||||
env.AppendUnique(CCFLAGS=["/utf-8"])
|
env.AppendUnique(CCFLAGS=["/utf-8"])
|
||||||
env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++
|
env.AppendUnique(CXXFLAGS=["/TP"]) # assume all sources are C++
|
||||||
if manual_msvc_config: # should be automatic if SCons found it
|
if manual_msvc_config: # should be automatic if SCons found it
|
||||||
if os.getenv("WindowsSdkDir") is not None:
|
if os.getenv("WindowsSdkDir") is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user