]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/c-c++-common/Wimplicit-fallthrough-19.c
Implement -Wimplicit-fallthrough.
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / Wimplicit-fallthrough-19.c
1 /* PR c/7652 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wimplicit-fallthrough" } */
4
5 /* Testing non-case labels. */
6
7 int foo (int);
8
9 void
10 f1 (int i)
11 {
12 switch (i)
13 {
14 case 0:
15 foo (1);
16 L1:
17 foo (2);
18 }
19
20 switch (i)
21 {
22 case 0:
23 foo (1); /* { dg-warning "statement may fall through" } */
24 L2:
25 case 2:
26 foo (2);
27 }
28
29 switch (i)
30 {
31 case 0:
32 foo (1); /* { dg-warning "statement may fall through" } */
33 case 2:
34 L3:
35 foo (2);
36 }
37
38 switch (i)
39 {
40 case 0:
41 foo (1); /* { dg-warning "statement may fall through" } */
42 L4:
43 case 2:
44 L5:
45 foo (2);
46 }
47
48 switch (i)
49 {
50 case 0:
51 switch (i)
52 {
53 case 1:
54 foo (2);
55 L6:
56 foo (3);
57 }
58 }
59
60 switch (i)
61 {
62 case 0:
63 switch (i)
64 {
65 case 1:
66 foo (2); /* { dg-warning "statement may fall through" } */
67 L7:
68 case 2:
69 foo (3);
70 }
71 }
72
73 switch (i)
74 {
75 case 0:
76 switch (i)
77 {
78 case 1:
79 foo (2); /* { dg-warning "statement may fall through" } */
80 case 2:
81 L8:
82 foo (3);
83 }
84 }
85 }