comparison gcc/testsuite/c-c++-common/Wimplicit-fallthrough-14.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 /* PR c/7652 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wimplicit-fallthrough" } */
4
5 /* Test various falls through comments. */
6
7 extern void bar (int);
8
9 void
10 fn (int i)
11 {
12 switch (i)
13 {
14 case -1:
15 bar (-1);
16 /*-fallthrough*/
17 case 0:
18 bar (0);
19 /*@fallthrough@*/
20 case 1:
21 bar (1);
22 /* FALL THRU */
23 case 2:
24 bar (2);
25 /* FALLTHRU */
26 case 3:
27 bar (3);
28 /* FALLS THRU */
29 case 4:
30 bar (4);
31 /* FALL-THRU */
32 case 5:
33 bar (5);
34 /* FALL THROUGH */
35 case 6:
36 bar (6);
37 /* FALLTHROUGH */
38 case 7:
39 bar (7);
40 /* FALLS THROUGH */
41 case 8:
42 bar (8);
43 /* FALL-THROUGH */
44 case 9:
45 bar (9);
46 /*FALLTHRU*/
47 case 10:
48 bar (10);
49 /* FALLTHRU.*/
50 case 11:
51 bar (11);
52 /* FALLTHROUGH. */
53 case 12:
54 bar (12);
55 /* Fall thru */
56 case 13:
57 bar (13);
58 /* Falls thru */
59 case 14:
60 bar (14);
61 /* Fall-thru */
62 case 15:
63 bar (15);
64 /* Fall Thru */
65 case 16:
66 bar (16);
67 /* Falls Thru */
68 case 17:
69 bar (17);
70 /* Fall-Thru */
71 case 18:
72 bar (18);
73 /* Fall through */
74 case 19:
75 bar (19);
76 /* Falls through */
77 case 20:
78 bar (20);
79 /* Fall-through */
80 case 21:
81 bar (21);
82 /* Fall Through */
83 case 22:
84 bar (22);
85 /* Falls Through */
86 case 23:
87 bar (23);
88 /* Fall-Through */
89 case 24:
90 bar (24);
91 /* Falls through. */
92 case 25:
93 bar (25);
94 /* Falls through. */
95 case 26:
96 bar (26);
97 /* fall thru */
98 case 27:
99 bar (27);
100 /* falls thru */
101 case 28:
102 bar (28);
103 /* fall-thru */
104 case 29:
105 bar (29);
106 /* fall thru */
107 case 30:
108 bar (30);
109 /* falls thru */
110 case 31:
111 bar (31);
112 /* fall-thru */
113 case 32:
114 bar (32);
115 /* fall through */
116 case 33:
117 bar (33);
118 /* falls through */
119 case 34:
120 bar (34);
121 /* fall-through */
122 default:
123 bar (99);
124 }
125
126 switch (i)
127 {
128 case 0:
129 i++;
130 /*@fallthrough@*/
131 L:
132 default:
133 bar (6);
134 }
135
136 {
137 __label__ L2;
138 switch (i)
139 {
140 case 0:
141 i++;
142 /*@fallthrough@*/
143 L2:
144 default:
145 bar (6);
146 }
147 }
148
149 /* Don't generate false -Wswitch-unreachable warning. */
150 switch (i)
151 {
152 /*FALLTHROUGH*/
153 case 0:
154 i++;
155 }
156
157 if (i)
158 {
159 /* fall through */
160 L1:;
161 }
162 }