Title: [219791] trunk/Source/WTF
Revision
219791
Author
[email protected]
Date
2017-07-23 14:01:28 -0700 (Sun, 23 Jul 2017)

Log Message

Implement FALLTHROUGH attribute for C with GCC
https://bugs.webkit.org/show_bug.cgi?id=174555

Reviewed by Darin Adler.

My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
implement it for C as well, using C attribute syntax.

Note this is only possible to do for GCC, because Clang only supports this attribute using
the [[C++ attribute syntax]].

* wtf/Compiler.h:

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (219790 => 219791)


--- trunk/Source/WTF/ChangeLog	2017-07-23 20:35:02 UTC (rev 219790)
+++ trunk/Source/WTF/ChangeLog	2017-07-23 21:01:28 UTC (rev 219791)
@@ -1,3 +1,19 @@
+2017-07-23  Michael Catanzaro  <[email protected]>
+
+        Implement FALLTHROUGH attribute for C with GCC
+        https://bugs.webkit.org/show_bug.cgi?id=174555
+
+        Reviewed by Darin Adler.
+
+        My previous attempt to silence the JSC -Wimplicit-fallthrough warnings failed because they
+        are coming from a C file, and our FALLTHROUGH macro is only implemented for C++. So
+        implement it for C as well, using C attribute syntax.
+ 
+        Note this is only possible to do for GCC, because Clang only supports this attribute using
+        the [[C++ attribute syntax]].
+
+        * wtf/Compiler.h:
+
 2017-07-14  Filip Pizlo  <[email protected]>
 
         It should be easy to decide how WebKit yields

Modified: trunk/Source/WTF/wtf/Compiler.h (219790 => 219791)


--- trunk/Source/WTF/wtf/Compiler.h	2017-07-23 20:35:02 UTC (rev 219790)
+++ trunk/Source/WTF/wtf/Compiler.h	2017-07-23 21:01:28 UTC (rev 219791)
@@ -212,6 +212,14 @@
 #define FALLTHROUGH [[gnu::fallthrough]]
 #endif
 
+#elif !defined(FALLTHROUGH) && !defined(__cplusplus)
+
+#if COMPILER(GCC)
+#if GCC_VERSION_AT_LEAST(7, 0, 0)
+#define FALLTHROUGH __attribute__ ((fallthrough))
+#endif
+#endif
+
 #endif // !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute)
 
 #if !defined(FALLTHROUGH)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to