comparison gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-do compile } */
2 /* { dg-options "-Wimplicit-fallthrough=3" } */
3
4 void bar (int);
5
6 void
7 foo (int i)
8 {
9 switch (i)
10 {
11 case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
12 bar (1);
13 case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
14 bar (2);
15 /* Some comment. */
16 case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
17 bar (3);
18 /* Here we really do want to fALl tHRoUgh and we mean it! */
19 case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
20 bar (4);
21 /* Intentionally fall through. */
22 case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
23 bar (5);
24 /* FALLTHROUGH */
25 case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
26 bar (6);
27 __attribute__((fallthrough));
28 case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */
29 bar (7);
30 default:
31 break;
32 }
33 }