Title: [292934] trunk/Source/WTF
Revision
292934
Author
[email protected]
Date
2022-04-15 18:11:06 -0700 (Fri, 15 Apr 2022)

Log Message

IGNORE_WARNINGS_BEGIN should not warn about unrecognized warnings
https://bugs.webkit.org/show_bug.cgi?id=239344

Patch by Michael Catanzaro <[email protected]> on 2022-04-15
Reviewed by Darin Adler.

If the compiler does not support __has_warning(), then let's also
suppress -Wpragmas to avoid warnings about unrecognized warnings.

Let's make a couple drive-by cleanups as well. Notably,
IGNORE_WARNINGS_BEGIN_IMPL_ is unused and can be removed.

* Source/WTF/wtf/Compiler.h:

Canonical link: https://commits.webkit.org/249699@main

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (292933 => 292934)


--- trunk/Source/WTF/ChangeLog	2022-04-16 00:49:45 UTC (rev 292933)
+++ trunk/Source/WTF/ChangeLog	2022-04-16 01:11:06 UTC (rev 292934)
@@ -1,3 +1,18 @@
+2022-04-15  Michael Catanzaro  <[email protected]>
+
+        IGNORE_WARNINGS_BEGIN should not warn about unrecognized warnings
+        https://bugs.webkit.org/show_bug.cgi?id=239344
+
+        Reviewed by Darin Adler.
+
+        If the compiler does not support __has_warning(), then let's also
+        suppress -Wpragmas to avoid warnings about unrecognized warnings.
+
+        Let's make a couple drive-by cleanups as well. Notably,
+        IGNORE_WARNINGS_BEGIN_IMPL_ is unused and can be removed.
+
+        * wtf/Compiler.h:
+
 2022-04-15  Zan Dobersek  <[email protected]>
 
         [GTK][WPE] Remove exclusive build guards around GPU process preferences, code

Modified: trunk/Source/WTF/wtf/Compiler.h (292933 => 292934)


--- trunk/Source/WTF/wtf/Compiler.h	2022-04-16 00:49:45 UTC (rev 292933)
+++ trunk/Source/WTF/wtf/Compiler.h	2022-04-16 01:11:06 UTC (rev 292934)
@@ -447,25 +447,33 @@
     _Pragma(_COMPILER_STRINGIZE(compiler diagnostic push)) \
     _COMPILER_CONCAT(IGNORE_WARNINGS_BEGIN_IMPL_, cond)(compiler, warning)
 
+/* Condition is either 1 (true) or 0 (false, do nothing). */
 #define IGNORE_WARNINGS_BEGIN_IMPL_1(compiler, warning) \
     _Pragma(_COMPILER_STRINGIZE(compiler diagnostic ignored warning))
 #define IGNORE_WARNINGS_BEGIN_IMPL_0(compiler, warning)
-#define IGNORE_WARNINGS_BEGIN_IMPL_(compiler, warning)
 
-
+#if defined(__has_warning)
 #define IGNORE_WARNINGS_END_IMPL(compiler) _Pragma(_COMPILER_STRINGIZE(compiler diagnostic pop))
+#else
+#define IGNORE_WARNINGS_END_IMPL(compiler) \
+    _Pragma(_COMPILER_STRINGIZE(compiler diagnostic pop)) \
+    _Pragma(_COMPILER_STRINGIZE(compiler diagnostic pop))
+#endif
 
 #if defined(__has_warning)
 #define _IGNORE_WARNINGS_BEGIN_IMPL(compiler, warning) \
     IGNORE_WARNINGS_BEGIN_COND(__has_warning(warning), compiler, warning)
 #else
-#define _IGNORE_WARNINGS_BEGIN_IMPL(compiler, warning) IGNORE_WARNINGS_BEGIN_COND(1, compiler, warning)
+/* Suppress -Wpragmas to dodge warnings about attempts to suppress unrecognized warnings. */
+#define _IGNORE_WARNINGS_BEGIN_IMPL(compiler, warning) \
+    IGNORE_WARNINGS_BEGIN_COND(1, compiler, "-Wpragmas") \
+    IGNORE_WARNINGS_BEGIN_COND(1, compiler, warning)
 #endif
 
 #define IGNORE_WARNINGS_BEGIN_IMPL(compiler, warning) \
     _IGNORE_WARNINGS_BEGIN_IMPL(compiler, _COMPILER_WARNING_NAME(warning))
 
-#endif // COMPILER(GCC) || COMPILER(CLANG)
+#endif /* COMPILER(GCC) || COMPILER(CLANG) */
 
 
 #if COMPILER(GCC)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to