]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Squelch annoying bogus Clang warnings.
authorGuy Harris <[email protected]>
Fri, 9 Nov 2018 20:54:00 +0000 (12:54 -0800)
committerGuy Harris <[email protected]>
Fri, 9 Nov 2018 20:54:00 +0000 (12:54 -0800)
netdissect-stdinc.h

index 6455e8a6952079826e7d9cf044a00d30782f99f3..8f1e5727642d04687887f0a9fe2fc86ae3a14bb3 100644 (file)
@@ -519,8 +519,16 @@ struct in6_addr {
  * it also implement __has_attribute() (for example, GCC 5.0 and later
  * have __has_attribute(), and the "fallthrough" attribute was introduced
  * in GCC 7).
+ *
+ * Unfortunately, Clang does this wrong - a statement
+ *
+ *    __attribute__ ((fallthrough));
+ *
+ * produces bogus -Wmissing-declaration "declaration does not declare
+ * anything" warnings (dear Clang: that's not a declaration, it's an
+ * empty statement).  GCC, however, has no trouble with this.
  */
-#if __has_attribute(fallthrough)
+#if __has_attribute(fallthrough) && !defined(__clang__)
 #  define ND_FALL_THROUGH __attribute__ ((fallthrough))
 #else
 #  define ND_FALL_THROUGH