diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub index a2ba425990d..8210c7f5c6b 100644 --- a/drivers/gl_context/SCsub +++ b/drivers/gl_context/SCsub @@ -13,11 +13,7 @@ if env["platform"] in ["macos", "windows", "linuxbsd"]: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - # Treat glad headers as system headers to avoid raising warnings. Not supported on MSVC. - if not env.msvc: - env.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) - else: - env.Prepend(CPPPATH=[thirdparty_dir]) + env.Prepend(CPPPATH=[thirdparty_dir]) env.Append(CPPDEFINES=["GLAD_ENABLED"]) env.Append(CPPDEFINES=["EGL_ENABLED"]) diff --git a/modules/basis_universal/SCsub b/modules/basis_universal/SCsub index 6eac52984ff..2963babd253 100644 --- a/modules/basis_universal/SCsub +++ b/modules/basis_universal/SCsub @@ -45,11 +45,7 @@ if basisu_encoder: transcoder_sources = [thirdparty_dir + "transcoder/basisu_transcoder.cpp"] -# Treat Basis headers as system headers to avoid raising warnings. Not supported on MSVC. -if not env.msvc: - env_basisu.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) -else: - env_basisu.Prepend(CPPPATH=[thirdparty_dir]) +env_basisu.Prepend(CPPPATH=[thirdparty_dir]) if basisu_encoder: env_basisu.Prepend(CPPPATH=["#thirdparty/tinyexr"]) diff --git a/modules/basis_universal/image_compress_basisu.cpp b/modules/basis_universal/image_compress_basisu.cpp index afd10a0db5f..4ef0ab95761 100644 --- a/modules/basis_universal/image_compress_basisu.cpp +++ b/modules/basis_universal/image_compress_basisu.cpp @@ -36,6 +36,11 @@ #include "core/string/print_string.h" #include "servers/rendering/rendering_server.h" +GODOT_GCC_WARNING_PUSH +GODOT_GCC_WARNING_IGNORE("-Wenum-conversion") +GODOT_GCC_WARNING_IGNORE("-Wshadow") +GODOT_GCC_WARNING_IGNORE("-Wunused-value") + #include #ifdef TOOLS_ENABLED #include @@ -44,6 +49,8 @@ static Mutex init_mutex; static bool initialized = false; #endif +GODOT_GCC_WARNING_POP + void basis_universal_init() { basist::basisu_transcoder_init(); } diff --git a/modules/glslang/SCsub b/modules/glslang/SCsub index 2aff345703f..78ef5051efc 100644 --- a/modules/glslang/SCsub +++ b/modules/glslang/SCsub @@ -62,13 +62,7 @@ if env["builtin_glslang"]: thirdparty_sources = [thirdparty_dir + file for file in thirdparty_sources] - # Treat glslang headers as system headers to avoid raising warnings. Not supported on MSVC. - # Include `#thirdparty` to workaround mismatch between location of `SPIRV` in library source - # and in installed public headers. - if not env.msvc: - env_glslang.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path, "-isystem", Dir("#thirdparty").path]) - else: - env_glslang.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty"]) + env_glslang.Prepend(CPPPATH=[thirdparty_dir, "#thirdparty"]) env_glslang.Append(CPPDEFINES=[("ENABLE_OPT", 0)]) diff --git a/modules/glslang/register_types.cpp b/modules/glslang/register_types.cpp index 764d339bac7..6df852bb0ad 100644 --- a/modules/glslang/register_types.cpp +++ b/modules/glslang/register_types.cpp @@ -33,10 +33,14 @@ #include "core/config/engine.h" #include "shader_compile.h" +GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wshadow") + #include #include #include +GODOT_GCC_WARNING_POP + Vector compile_glslang_shader(RenderingDeviceCommons::ShaderStage p_stage, const String &p_source_code, RenderingDeviceCommons::ShaderLanguageVersion p_language_version, RenderingDeviceCommons::ShaderSpirvVersion p_spirv_version, String *r_error) { Vector ret; EShLanguage stages[RenderingDeviceCommons::SHADER_STAGE_MAX] = { diff --git a/modules/minimp3/SCsub b/modules/minimp3/SCsub index e9491bb72ff..d64431fc57b 100644 --- a/modules/minimp3/SCsub +++ b/modules/minimp3/SCsub @@ -8,11 +8,7 @@ env_minimp3 = env_modules.Clone() thirdparty_dir = "#thirdparty/minimp3/" -# Treat minimp3 headers as system headers to avoid raising warnings. Not supported on MSVC. -if not env.msvc: - env_minimp3.Append(CPPFLAGS=["-isystem", Dir(thirdparty_dir).path]) -else: - env_minimp3.Prepend(CPPPATH=[thirdparty_dir]) +env_minimp3.Prepend(CPPPATH=[thirdparty_dir]) if not env["minimp3_extra_formats"]: env_minimp3.Append(CPPDEFINES=["MINIMP3_ONLY_MP3"]) diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub index 7fc04a72e47..2f108f89268 100644 --- a/modules/text_server_adv/SCsub +++ b/modules/text_server_adv/SCsub @@ -512,12 +512,8 @@ if env["builtin_icu4c"]: module_obj = [] if env["builtin_msdfgen"] and msdfgen_enabled: - # Treat msdfgen headers as system headers to avoid raising warnings. Not supported on MSVC. env_text_server_adv.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")]) - if not env.msvc: - env_text_server_adv.Append(CPPFLAGS=["-isystem", Dir("#thirdparty/msdfgen").path]) - else: - env_text_server_adv.Prepend(CPPPATH=["#thirdparty/msdfgen"]) + env_text_server_adv.Prepend(CPPPATH=["#thirdparty/msdfgen"]) if env["builtin_freetype"] and freetype_enabled: env_text_server_adv.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"]) diff --git a/modules/text_server_adv/text_server_adv.cpp b/modules/text_server_adv/text_server_adv.cpp index 8ee093838cd..4eea248a32d 100644 --- a/modules/text_server_adv/text_server_adv.cpp +++ b/modules/text_server_adv/text_server_adv.cpp @@ -67,6 +67,7 @@ using namespace godot; // Thirdparty headers. #ifdef MODULE_MSDFGEN_ENABLED +GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wshadow") GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides class member". #include @@ -75,6 +76,7 @@ GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides c #include #include +GODOT_GCC_WARNING_POP GODOT_MSVC_WARNING_POP #endif diff --git a/modules/text_server_fb/SCsub b/modules/text_server_fb/SCsub index b56df192c25..ca95fee7308 100644 --- a/modules/text_server_fb/SCsub +++ b/modules/text_server_fb/SCsub @@ -17,12 +17,8 @@ if "svg" in env.module_list: env_text_server_fb.Append(CPPDEFINES=["TVG_STATIC"]) if env["builtin_msdfgen"] and msdfgen_enabled: - # Treat msdfgen headers as system headers to avoid raising warnings. Not supported on MSVC. env_text_server_fb.Append(CPPDEFINES=[("MSDFGEN_PUBLIC", "")]) - if not env.msvc: - env_text_server_fb.Append(CPPFLAGS=["-isystem", Dir("#thirdparty/msdfgen").path]) - else: - env_text_server_fb.Prepend(CPPPATH=["#thirdparty/msdfgen"]) + env_text_server_fb.Prepend(CPPPATH=["#thirdparty/msdfgen"]) if env["builtin_freetype"] and freetype_enabled: env_text_server_fb.Append(CPPDEFINES=["FT_CONFIG_OPTION_USE_BROTLI"]) diff --git a/modules/text_server_fb/text_server_fb.cpp b/modules/text_server_fb/text_server_fb.cpp index a69933e352d..3b2c4bd82ec 100644 --- a/modules/text_server_fb/text_server_fb.cpp +++ b/modules/text_server_fb/text_server_fb.cpp @@ -62,6 +62,7 @@ using namespace godot; // Thirdparty headers. #ifdef MODULE_MSDFGEN_ENABLED +GODOT_GCC_WARNING_PUSH_AND_IGNORE("-Wshadow") GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides class member". #include @@ -70,6 +71,7 @@ GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides c #include #include +GODOT_GCC_WARNING_POP GODOT_MSVC_WARNING_POP #endif diff --git a/thirdparty/README.md b/thirdparty/README.md index 1cd27a5af28..a5d2672c988 100644 --- a/thirdparty/README.md +++ b/thirdparty/README.md @@ -90,7 +90,7 @@ Patches: - `0003-remove-tinydds-qoi.patch` (GH-97582) - `0004-ambiguous-calls.patch` (GH-103968) - `0005-msvc-include-ctype.patch` (GH-106155) - +- `0006-clang-warning-exclude.patch` (GH-111346) ## brotli diff --git a/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp b/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp index a667d0d6378..742427c838f 100644 --- a/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp +++ b/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp @@ -837,7 +837,7 @@ void decodeISETritBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& deUint32 T7 = data.getNext(1); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" #endif @@ -854,7 +854,7 @@ void decodeISETritBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& DE_ASSERT(false); } #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif @@ -903,7 +903,7 @@ void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& deUint32 Q56 = data.getNext(2); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" #endif @@ -918,7 +918,7 @@ void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& DE_ASSERT(false); } #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif diff --git a/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h b/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h index a9fe6b27aa0..356aaba97a2 100644 --- a/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h +++ b/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h @@ -232,14 +232,14 @@ namespace basisu inline void set_to_black() { #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif #endif memset(m_blocks.get_ptr(), 0, m_blocks.size_in_bytes()); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif diff --git a/thirdparty/basis_universal/patches/0006-clang-warning-exclude.patch b/thirdparty/basis_universal/patches/0006-clang-warning-exclude.patch new file mode 100644 index 00000000000..3baf550135d --- /dev/null +++ b/thirdparty/basis_universal/patches/0006-clang-warning-exclude.patch @@ -0,0 +1,165 @@ + .../encoder/3rdparty/android_astc_decomp.cpp | 8 ++++---- + thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h | 4 ++-- + thirdparty/basis_universal/transcoder/basisu.h | 4 ++-- + .../basis_universal/transcoder/basisu_containers.h | 16 ++++++++-------- + 4 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp b/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp +index a667d0d637..742427c838 100644 +--- a/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp ++++ b/thirdparty/basis_universal/encoder/3rdparty/android_astc_decomp.cpp +@@ -837,7 +837,7 @@ void decodeISETritBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& + deUint32 T7 = data.getNext(1); + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" + #endif +@@ -854,7 +854,7 @@ void decodeISETritBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& + DE_ASSERT(false); + } + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +@@ -903,7 +903,7 @@ void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& + deUint32 Q56 = data.getNext(2); + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wimplicit-fallthrough=" + #endif +@@ -918,7 +918,7 @@ void decodeISEQuintBlock (ISEDecodedResult* dst, int numValues, BitAccessStream& + DE_ASSERT(false); + } + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +diff --git a/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h b/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h +index a9fe6b27aa..356aaba97a 100644 +--- a/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h ++++ b/thirdparty/basis_universal/encoder/basisu_pvrtc1_4.h +@@ -232,14 +232,14 @@ namespace basisu + inline void set_to_black() + { + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif + #endif + memset(m_blocks.get_ptr(), 0, m_blocks.size_in_bytes()); + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +diff --git a/thirdparty/basis_universal/transcoder/basisu.h b/thirdparty/basis_universal/transcoder/basisu.h +index 44fb9a3007..1dbf14ace3 100644 +--- a/thirdparty/basis_universal/transcoder/basisu.h ++++ b/thirdparty/basis_universal/transcoder/basisu.h +@@ -108,7 +108,7 @@ namespace basisu + } + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif +@@ -117,7 +117,7 @@ namespace basisu + template inline void clear_obj(T& obj) { memset(&obj, 0, sizeof(obj)); } + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +diff --git a/thirdparty/basis_universal/transcoder/basisu_containers.h b/thirdparty/basis_universal/transcoder/basisu_containers.h +index 7fff4c243e..d30736842a 100644 +--- a/thirdparty/basis_universal/transcoder/basisu_containers.h ++++ b/thirdparty/basis_universal/transcoder/basisu_containers.h +@@ -1505,7 +1505,7 @@ namespace basisu + { + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif +@@ -1515,7 +1515,7 @@ namespace basisu + memcpy(m_p, other.m_p, m_size * sizeof(T)); + } + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +@@ -1650,7 +1650,7 @@ namespace basisu + if (BASISU_IS_BITWISE_COPYABLE(T)) + { + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif +@@ -1658,7 +1658,7 @@ namespace basisu + if ((m_p) && (other.m_p)) + memcpy(m_p, other.m_p, other.m_size * sizeof(T)); + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +@@ -2235,7 +2235,7 @@ namespace basisu + // Copy "down" the objects to preserve, filling in the empty slots. + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif +@@ -2244,7 +2244,7 @@ namespace basisu + memmove(pDst, pSrc, num_to_move * sizeof(T)); + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif +@@ -2493,7 +2493,7 @@ namespace basisu + if ((sizeof(T) == 1) && (scalar_type::cFlag)) + { + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wclass-memaccess" + #endif +@@ -2501,7 +2501,7 @@ namespace basisu + memset(m_p, *reinterpret_cast(&o), m_size); + + #ifndef __EMSCRIPTEN__ +-#ifdef __GNUC__ ++#if defined(__GNUC__) && !defined(__clang__) + #pragma GCC diagnostic pop + #endif + #endif diff --git a/thirdparty/basis_universal/transcoder/basisu.h b/thirdparty/basis_universal/transcoder/basisu.h index 44fb9a3007b..1dbf14ace30 100644 --- a/thirdparty/basis_universal/transcoder/basisu.h +++ b/thirdparty/basis_universal/transcoder/basisu.h @@ -108,7 +108,7 @@ namespace basisu } #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif @@ -117,7 +117,7 @@ namespace basisu template inline void clear_obj(T& obj) { memset(&obj, 0, sizeof(obj)); } #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif diff --git a/thirdparty/basis_universal/transcoder/basisu_containers.h b/thirdparty/basis_universal/transcoder/basisu_containers.h index 7fff4c243ea..d30736842a5 100644 --- a/thirdparty/basis_universal/transcoder/basisu_containers.h +++ b/thirdparty/basis_universal/transcoder/basisu_containers.h @@ -1505,7 +1505,7 @@ namespace basisu { #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif @@ -1515,7 +1515,7 @@ namespace basisu memcpy(m_p, other.m_p, m_size * sizeof(T)); } #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif @@ -1650,7 +1650,7 @@ namespace basisu if (BASISU_IS_BITWISE_COPYABLE(T)) { #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif @@ -1658,7 +1658,7 @@ namespace basisu if ((m_p) && (other.m_p)) memcpy(m_p, other.m_p, other.m_size * sizeof(T)); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif @@ -2235,7 +2235,7 @@ namespace basisu // Copy "down" the objects to preserve, filling in the empty slots. #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif @@ -2244,7 +2244,7 @@ namespace basisu memmove(pDst, pSrc, num_to_move * sizeof(T)); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif @@ -2493,7 +2493,7 @@ namespace basisu if ((sizeof(T) == 1) && (scalar_type::cFlag)) { #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wclass-memaccess" #endif @@ -2501,7 +2501,7 @@ namespace basisu memset(m_p, *reinterpret_cast(&o), m_size); #ifndef __EMSCRIPTEN__ -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) #pragma GCC diagnostic pop #endif #endif