Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/c-c++-common/Wimplicit-fallthrough-36.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* PR c/79153 */ | |
2 /* { dg-do compile } */ | |
3 /* { dg-options "-Wimplicit-fallthrough" } */ | |
4 | |
5 int | |
6 test (int v1, int v2) | |
7 { | |
8 switch (v1) | |
9 { | |
10 case 3: | |
11 switch (v2) /* { dg-warning "this statement may fall through" } */ | |
12 { | |
13 case 1: | |
14 return 28; | |
15 case 2: | |
16 return 38; | |
17 case 3: | |
18 return 88; | |
19 default: | |
20 break; | |
21 } | |
22 case 4: /* { dg-message "here" } */ | |
23 return 168; | |
24 case 5: | |
25 switch (v2) /* { dg-warning "this statement may fall through" } */ | |
26 { | |
27 case 4: | |
28 break; | |
29 case 5: | |
30 return 38; | |
31 case 6: | |
32 return 88; | |
33 } | |
34 case 6: /* { dg-message "here" } */ | |
35 return 169; | |
36 case 7: | |
37 switch (v2) /* { dg-warning "this statement may fall through" } */ | |
38 { | |
39 case 7: | |
40 return 38; | |
41 case 8: | |
42 return 88; | |
43 } | |
44 case 8: /* { dg-message "here" } */ | |
45 return 170; | |
46 case 9: | |
47 switch (v2) /* { dg-bogus "this statement may fall through" } */ | |
48 { | |
49 case 9: | |
50 return 38; | |
51 case 10: | |
52 return 88; | |
53 default: | |
54 return 89; | |
55 } | |
56 case 10: | |
57 return 171; | |
58 case 11: | |
59 switch (v2) /* { dg-bogus "this statement may fall through" } */ | |
60 { | |
61 case -__INT_MAX__ - 1 ... 31: | |
62 return 38; | |
63 case 32: | |
64 return 88; | |
65 case 33 ... __INT_MAX__: | |
66 return 89; | |
67 } | |
68 case 12: | |
69 return 172; | |
70 } | |
71 return -1; | |
72 } |