about summary refs log tree commit diff
path: root/m4
diff options
context:
space:
mode:
authorSebastien Bacher <seb128@ubuntu.com>2020-03-13 16:27:57 +0100
committerSebastien Bacher <seb128@ubuntu.com>2020-03-13 16:27:57 +0100
commita46c3e57291e64e9258698dbe5b0ef11def833c5 (patch)
treede9a6dcb3ab058a02fa0a2d9e7d1b3572b588583 /m4
parent767904eab32f132502230df57e146cb822dad7ba (diff)
parent19e73abd360f0198f94ce49f36ddf009056f6324 (diff)
Merge remote-tracking branch 'salsa/debian/master' into ubuntu/master
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)