summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2018-11-09 12:54:00 -0800
committerGuy Harris <guy@alum.mit.edu>2018-11-09 12:54:00 -0800
commit1c803f7812c7cd69cc9a90ac11ead8f48bfba64c (patch)
tree9078f9af51f0772cfff0efd2cc5b6fe8bd236634
parent65f3770fd734e0320441984ee033cdb03bbfbd16 (diff)
downloadtcpdump-1c803f7812c7cd69cc9a90ac11ead8f48bfba64c.tar.gz
Squelch annoying bogus Clang warnings.
-rw-r--r--netdissect-stdinc.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/netdissect-stdinc.h b/netdissect-stdinc.h
index 6455e8a6..8f1e5727 100644
--- a/netdissect-stdinc.h
+++ b/netdissect-stdinc.h
@@ -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