summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-08-06 12:55:40 +0200
committerGitHub <noreply@github.com>2021-08-06 12:55:40 +0200
commitb3c2281706778cf5311a68fe0071aa2740d01131 (patch)
tree28e546afd0916a6f6dbab2360e1f335d93e853a1
parent9f4e9ad75cfecdefd8d8158d59e3dd976df373b2 (diff)
parentc44ebb020d633e0e375a2d6d6ca6c1ba09e79111 (diff)
Merge pull request #50487 from akien-mga/clang-warning-Wordered-compare-function-pointers
-rw-r--r--.github/workflows/javascript_builds.yml2
-rw-r--r--SConstruct18
-rw-r--r--methods.py4
-rw-r--r--modules/freetype/SCsub1
-rw-r--r--modules/websocket/emws_peer.cpp2
5 files changed, 18 insertions, 9 deletions
diff --git a/.github/workflows/javascript_builds.yml b/.github/workflows/javascript_builds.yml
index ced2c36a91..7f7ebf680f 100644
--- a/.github/workflows/javascript_builds.yml
+++ b/.github/workflows/javascript_builds.yml
@@ -4,7 +4,7 @@ on: [push, pull_request]
# Global Settings
env:
GODOT_BASE_BRANCH: master
- SCONSFLAGS: platform=javascript verbose=yes warnings=extra debug_symbols=no --jobs=2
+ SCONSFLAGS: platform=javascript verbose=yes warnings=extra werror=yes debug_symbols=no --jobs=2
SCONS_CACHE_LIMIT: 4096
EM_VERSION: 2.0.25
EM_CACHE_FOLDER: 'emsdk-cache'
diff --git a/SConstruct b/SConstruct
index 5dec3f2020..45108721ad 100644
--- a/SConstruct
+++ b/SConstruct
@@ -506,13 +506,17 @@ if selected_platform in platform_list:
if env["werror"]:
env.Append(CCFLAGS=["/WX"])
else: # GCC, Clang
- gcc_common_warnings = []
+ common_warnings = []
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) or methods.using_emcc(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":
- 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"])
if methods.using_gcc(env):
env.Append(
@@ -528,12 +532,12 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=["-Wplacement-new=1"])
if cc_version_major >= 9:
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"])
elif env["warnings"] == "all":
- env.Append(CCFLAGS=["-Wall"] + gcc_common_warnings)
+ env.Append(CCFLAGS=["-Wall"] + common_warnings)
elif env["warnings"] == "moderate":
- env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + gcc_common_warnings)
+ env.Append(CCFLAGS=["-Wall", "-Wno-unused"] + common_warnings)
else: # 'no'
env.Append(CCFLAGS=["-w"])
@@ -544,7 +548,7 @@ if selected_platform in platform_list:
env.Append(CXXFLAGS=["-Wno-error=cpp"])
if cc_version_major == 7: # Bogus warning fixed in 8+.
env.Append(CCFLAGS=["-Wno-error=strict-overflow"])
- else:
+ elif methods.using_clang(env) or methods.using_emcc(env):
env.Append(CXXFLAGS=["-Wno-error=#warnings"])
else: # always enable those errors
env.Append(CCFLAGS=["-Werror=return-type"])
diff --git a/methods.py b/methods.py
index 13851d8315..970bd10aa3 100644
--- a/methods.py
+++ b/methods.py
@@ -828,6 +828,10 @@ def using_clang(env):
return "clang" in os.path.basename(env["CC"])
+def using_emcc(env):
+ return "emcc" in os.path.basename(env["CC"])
+
+
def show_progress(env):
import sys
from SCons.Script import Progress, Command, AlwaysBuild
diff --git a/modules/freetype/SCsub b/modules/freetype/SCsub
index fc2535a6ca..476cb9cf2a 100644
--- a/modules/freetype/SCsub
+++ b/modules/freetype/SCsub
@@ -80,6 +80,7 @@ if env["builtin_freetype"]:
# Forcibly undefine this macro so SIMD is not used in this file,
# since currently unsupported in WASM
tmp_env = env_freetype.Clone()
+ tmp_env.disable_warnings()
tmp_env.Append(CPPFLAGS=["-U__OPTIMIZE__"])
sfnt = tmp_env.Object(sfnt)
thirdparty_sources += [sfnt]
diff --git a/modules/websocket/emws_peer.cpp b/modules/websocket/emws_peer.cpp
index 69822f6ff3..d7263dcf43 100644
--- a/modules/websocket/emws_peer.cpp
+++ b/modules/websocket/emws_peer.cpp
@@ -54,7 +54,7 @@ Error EMWSPeer::read_msg(const uint8_t *p_data, uint32_t p_size, bool p_is_strin
}
Error EMWSPeer::put_packet(const uint8_t *p_buffer, int p_buffer_size) {
- ERR_FAIL_COND_V(_out_buf_size && (godot_js_websocket_buffered_amount(peer_sock) >= (1ULL << _out_buf_size)), ERR_OUT_OF_MEMORY);
+ ERR_FAIL_COND_V(_out_buf_size && ((uint64_t)godot_js_websocket_buffered_amount(peer_sock) >= (1ULL << _out_buf_size)), ERR_OUT_OF_MEMORY);
int is_bin = write_mode == WebSocketPeer::WRITE_MODE_BINARY ? 1 : 0;