Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 Add an example of attribute fallth...
details: https://anonhg.NetBSD.org/src/rev/1d0fcd49e297
branches: trunk
changeset: 1020448:1d0fcd49e297
user: christos <christos%NetBSD.org@localhost>
date: Mon Apr 12 15:54:55 2021 +0000
description:
Add an example of attribute fallthrough
diffstat:
tests/usr.bin/xlint/lint1/msg_220.c | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diffs (31 lines):
diff -r 99b523aabcf0 -r 1d0fcd49e297 tests/usr.bin/xlint/lint1/msg_220.c
--- a/tests/usr.bin/xlint/lint1/msg_220.c Mon Apr 12 13:28:35 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_220.c Mon Apr 12 15:54:55 2021 +0000
@@ -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 @@
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");
+ }
+}
Home |
Main Index |
Thread Index |
Old Index