瀏覽代碼

SCons: Remove system includes

Thaddeus Crews 2 周之前
父節點
當前提交
b95024752a

+ 1 - 5
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"])

+ 1 - 5
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"])

+ 7 - 0
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 <transcoder/basisu_transcoder.h>
 #ifdef TOOLS_ENABLED
 #include <encoder/basisu_comp.h>
@@ -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();
 }

+ 1 - 7
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)])
 

+ 4 - 0
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 <glslang/Public/ResourceLimits.h>
 #include <glslang/Public/ShaderLang.h>
 #include <glslang/SPIRV/GlslangToSpv.h>
 
+GODOT_GCC_WARNING_POP
+
 Vector<uint8_t> 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<uint8_t> ret;
 	EShLanguage stages[RenderingDeviceCommons::SHADER_STAGE_MAX] = {

+ 1 - 5
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"])

+ 1 - 5
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"])

+ 2 - 0
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 <core/EdgeHolder.h>
@@ -75,6 +76,7 @@ GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides c
 #include <core/edge-selectors.h>
 #include <msdfgen.h>
 
+GODOT_GCC_WARNING_POP
 GODOT_MSVC_WARNING_POP
 #endif
 

+ 1 - 5
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"])

+ 2 - 0
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 <core/EdgeHolder.h>
@@ -70,6 +71,7 @@ GODOT_MSVC_WARNING_PUSH_AND_IGNORE(4458) // "Declaration of 'identifier' hides c
 #include <core/edge-selectors.h>
 #include <msdfgen.h>
 
+GODOT_GCC_WARNING_POP
 GODOT_MSVC_WARNING_POP
 #endif
 

+ 1 - 1
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
 

+ 4 - 4
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

+ 2 - 2
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

+ 165 - 0
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 <typename T> 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<T>::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<const uint8_t*>(&o), m_size);
+ 
+ #ifndef __EMSCRIPTEN__            
+-#ifdef __GNUC__
++#if defined(__GNUC__) && !defined(__clang__)
+ #pragma GCC diagnostic pop
+ #endif                        
+ #endif

+ 2 - 2
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 <typename T> 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

+ 8 - 8
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<T>::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<const uint8_t*>(&o), m_size);
 
 #ifndef __EMSCRIPTEN__            
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
 #pragma GCC diagnostic pop
 #endif                        
 #endif