瀏覽代碼

Merge pull request #96108 from RandomShaper/fix_warn_in_all

Properly mute `-Wundefined-var-template` Clang warning in SafeBinaryMutex
Rémi Verschelde 1 年之前
父節點
當前提交
5d1b07e464
共有 2 個文件被更改,包括 10 次插入1 次删除
  1. 1 1
      SConstruct
  2. 9 0
      core/os/safe_binary_mutex.h

+ 1 - 1
SConstruct

@@ -861,7 +861,7 @@ else:  # GCC, Clang
             if cc_version_major >= 11:  # Broke on MethodBind templates before GCC 11.
             if cc_version_major >= 11:  # Broke on MethodBind templates before GCC 11.
                 env.Append(CCFLAGS=["-Wlogical-op"])
                 env.Append(CCFLAGS=["-Wlogical-op"])
         elif methods.using_clang(env) or methods.using_emcc(env):
         elif methods.using_clang(env) or methods.using_emcc(env):
-            env.Append(CCFLAGS=["-Wimplicit-fallthrough", "-Wno-undefined-var-template"])
+            env.Append(CCFLAGS=["-Wimplicit-fallthrough"])
     elif env["warnings"] == "all":
     elif env["warnings"] == "all":
         env.Append(CCFLAGS=["-Wall"] + common_warnings)
         env.Append(CCFLAGS=["-Wall"] + common_warnings)
     elif env["warnings"] == "moderate":
     elif env["warnings"] == "moderate":

+ 9 - 0
core/os/safe_binary_mutex.h

@@ -37,6 +37,11 @@
 
 
 #ifdef THREADS_ENABLED
 #ifdef THREADS_ENABLED
 
 
+#ifdef __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wundefined-var-template"
+#endif
+
 // A very special kind of mutex, used in scenarios where these
 // A very special kind of mutex, used in scenarios where these
 // requirements hold at the same time:
 // requirements hold at the same time:
 // - Must be used with a condition variable (only binary mutexes are suitable).
 // - Must be used with a condition variable (only binary mutexes are suitable).
@@ -105,6 +110,10 @@ public:
 	}
 	}
 };
 };
 
 
+#ifdef __clang__
+#pragma clang diagnostic pop
+#endif
+
 #else // No threads.
 #else // No threads.
 
 
 template <int Tag>
 template <int Tag>