Debian Codegraph @

gcc/testsuite/c-c++-common/Wimplicit-fallthrough-20.c

raw
1 /* PR c/7652 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wimplicit-fallthrough" } */
4
5 int
6 f (int i)
7 {
8 switch (i)
9 {
10 case -1:
11 __attribute__((fallthrough));
12 default:
13 __attribute__((fallthrough));
14 case 1:
15 return 6;
16 case 2 ... 4:
17 __attribute__((fallthrough));
18 case 5:
19 return 7;
20 }
21 return 0;
22 }
23
24 int
25 g (int i)
26 {
27 switch (i)
28 {
29 case -1:
30 __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
31 default:
32 __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
33 case 1:
34 return 6;
35 case 2 ... 4:
36 __attribute__((used)); /* { dg-warning "empty declaration|ignored" } */
37 case 5:
38 return 7;
39 }
40 return 0;
41 }