summary refs log tree commit diff
path: root/m4
diff options
context:
space:
mode:
Diffstat (limited to 'm4')
-rw-r--r--m4/compiler_options.m421
1 files changed, 20 insertions, 1 deletions
diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4
index 5235e037..1483f3ed 100644
--- a/m4/compiler_options.m4
+++ b/m4/compiler_options.m4
@@ -70,7 +70,6 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 		      -Wfloat-equal \
 		      -Wformat-nonliteral \
 		      -Wformat-security \
-		      -Wimplicit-fallthrough \
 		      -Wimplicit-function-declaration \
 		      -Winit-self \
 		      -Wlogical-op \
@@ -136,6 +135,26 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
 		[G_DEFINE_TYPE (NMObject, nm_object, G_TYPE_OBJECT)]
 	)
 
+	dnl clang started supporting -Wimplicit-fallthrough, but it does not
+	dnl honor the code comments to suppress the warning. Disable the
+	dnl warning with clang.
+	dnl
+	NM_COMPILER_WARNING([$1], [implicit-fallthrough],
+		[int foo(int a);
+	     int foo(int a) {
+		    int r = 0;
+		    switch (a) {
+		    case 1:
+		       r++;
+		       /* fall-through */
+		    case 2:
+		       r++;
+		       break;
+		    }
+		    return r;
+		 }]
+	)
+
 	eval "AS_TR_SH([$1])='$CFLAGS_MORE_WARNINGS $$1'"
 else
 	AC_MSG_RESULT(no)