aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c')
-rw-r--r--gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c
new file mode 100644
index 0000000..7c685f6
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-28.c
@@ -0,0 +1,33 @@
+/* { dg-do compile } */
+/* { dg-options "-Wimplicit-fallthrough=2" } */
+
+void bar (int);
+
+void
+foo (int i)
+{
+ switch (i)
+ {
+ case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (1);
+ case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (2);
+ /* Some comment. */
+ case 3: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (3);
+ /* Here we really do want to fALl tHRoUgh and we mean it! */
+ case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (4);
+ /* Intentionally fall through. */
+ case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (5);
+ /* FALLTHROUGH */
+ case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (6);
+ __attribute__((fallthrough));
+ case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
+ bar (7);
+ default:
+ break;
+ }
+}