Module Name:    src
Committed By:   rillig
Date:           Sun Aug 29 08:57:50 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_220.c msg_220.exp

Log Message:
tests/lint: test variants of the FALLTHROUGH comment


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_220.c
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_220.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/usr.bin/xlint/lint1/msg_220.c
diff -u src/tests/usr.bin/xlint/lint1/msg_220.c:1.3 src/tests/usr.bin/xlint/lint1/msg_220.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_220.c:1.3	Mon Apr 12 15:54:55 2021
+++ src/tests/usr.bin/xlint/lint1/msg_220.c	Sun Aug 29 08:57:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg_220.c,v 1.3 2021/04/12 15:54:55 christos Exp $	*/
+/*	$NetBSD: msg_220.c,v 1.4 2021/08/29 08:57:50 rillig Exp $	*/
 # 3 "msg_220.c"
 
 // Test for message: fallthrough on case statement [220]
@@ -41,3 +41,32 @@ example1(int n)
 		println("number");
 	}
 }
+
+/* https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough */
+void
+annotation_comment_variations(int n)
+{
+	switch (n) {
+	case 0:
+		println("0");
+		/* FALLTHROUGH */
+	case 1:
+		println("1");
+		/* FALL THROUGH */
+		/* expect+1: warning: fallthrough on case statement [220] */
+	case 2:
+		println("2");
+		/* FALLS THROUGH */
+		/* expect+1: warning: fallthrough on case statement [220] */
+	case 3:
+		println("3");
+		/* intentionally falls through */
+		/* expect+1: warning: fallthrough on case statement [220] */
+	case 4:
+		println("4");
+		/* @fallthrough@ */
+		/* expect+1: warning: fallthrough on case statement [220] */
+	case 5:
+		println("5");
+	}
+}

Index: src/tests/usr.bin/xlint/lint1/msg_220.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_220.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_220.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_220.exp:1.2	Sat Jan 30 17:02:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_220.exp	Sun Aug 29 08:57:50 2021
@@ -1,2 +1,6 @@
 msg_220.c(19): warning: fallthrough on case statement [220]
 msg_220.c(22): warning: fallthrough on default statement [284]
+msg_220.c(57): warning: fallthrough on case statement [220]
+msg_220.c(61): warning: fallthrough on case statement [220]
+msg_220.c(65): warning: fallthrough on case statement [220]
+msg_220.c(69): warning: fallthrough on case statement [220]

Reply via email to