rts: Disable fallthrough attribute when compiling with Clang
authorBen Gamari <ben@smart-cactus.org>
Tue, 11 Dec 2018 02:48:51 +0000 (21:48 -0500)
committerBen Gamari <ben@smart-cactus.org>
Tue, 11 Dec 2018 15:03:40 +0000 (10:03 -0500)
Apparently clang doesn't enable implicitly fallthrough warnings by default
http://llvm.org/viewvc/llvm-project?revision=167655&view=revision when compiling
C and the attribute cause warnings of their own (#16019).

includes/Stg.h

index 9b54526..57cb00d 100644 (file)
 #endif
 
 /* Used to mark a switch case that falls-through */
-#if (defined(__GNUC__) && __GNUC__ >= 7) || defined(__clang__)
+#if (defined(__GNUC__) && __GNUC__ >= 7)
+// N.B. Don't enable fallthrough annotations when compiling with Clang.
+// Apparently clang doesn't enable implicitly fallthrough warnings by default
+// http://llvm.org/viewvc/llvm-project?revision=167655&view=revision
+// when compiling C and the attribute cause warnings of their own (#16019).
 #define FALLTHROUGH GNU_ATTRIBUTE(fallthrough)
 #else
 #define FALLTHROUGH ((void)0)