Module Name: src
Committed By: christos
Date: Mon Apr 12 15:54:55 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_220.c
Log Message:
Add an example of attribute fallthrough
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_220.c
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.2 src/tests/usr.bin/xlint/lint1/msg_220.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_220.c:1.2 Sat Jan 30 12:02:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_220.c Mon Apr 12 11:54:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: msg_220.c,v 1.2 2021/01/30 17:02:58 rillig Exp $ */
+/* $NetBSD: msg_220.c,v 1.3 2021/04/12 15:54:55 christos Exp $ */
# 3 "msg_220.c"
// Test for message: fallthrough on case statement [220]
@@ -23,3 +23,21 @@ example(int n)
println("number");
}
}
+
+void
+example1(int n)
+{
+ switch (n) {
+ case 1:
+ case 3:
+ case 5:
+ println("odd");
+ __attribute__((__fallthrough__));
+ case 2:
+ case 7:
+ println("prime");
+ __attribute__((__fallthrough__));
+ default:
+ println("number");
+ }
+}