]>
Commit | Line | Data |
---|---|---|
7bad794a JJ |
1 | /* { dg-do compile } */ |
2 | /* { dg-options "-Wimplicit-fallthrough" } */ | |
3 | ||
4 | void bar (int); | |
5 | ||
6 | void | |
7 | foo (int i) | |
8 | { | |
9 | switch (i) | |
10 | { | |
11 | case 1: | |
12 | bar (1); /* { dg-bogus "this statement may \[laf]* through" } */ | |
13 | /* FALLTHROUGH */ | |
14 | case 2: | |
15 | bar (2); | |
16 | break; | |
17 | case 3: | |
18 | bar (3); /* { dg-bogus "this statement may \[laf]* through" } */ | |
19 | /* FALLS THRU. */ | |
20 | /* Some other comment. */ | |
21 | case 4: | |
22 | bar (4); | |
23 | break; | |
81b02905 JJ |
24 | case 5: |
25 | bar (5); /* { dg-bogus "this statement may \[laf]* through" } */ | |
26 | /* Else Fall-Thru! */ | |
27 | case 6: | |
28 | bar (6); | |
29 | break; | |
7bad794a JJ |
30 | case 7: |
31 | bar (7); /* { dg-bogus "this statement may \[laf]* through" } */ | |
32 | /* Some comment. */ | |
81b02905 | 33 | /* ... fallthrough ... */ |
7bad794a JJ |
34 | /* Some other comment. */ |
35 | /* And yet another. */ | |
36 | case 8: | |
37 | bar (8); | |
38 | break; | |
81b02905 JJ |
39 | case 9: |
40 | bar (9); /* { dg-bogus "this statement may \[laf]* through" } */ | |
41 | /* Intentional Fallthru */ | |
42 | case 10: | |
43 | bar (10); | |
44 | break; | |
45 | case 11: | |
46 | bar (11); /* { dg-bogus "this statement may \[laf]* through" } */ | |
47 | /* intentionally fall through */ | |
48 | case 12: | |
49 | bar (12); | |
50 | break; | |
51 | case 13: | |
52 | bar (13); /* { dg-bogus "this statement may \[laf]* through" } */ | |
53 | /* Falls Through - for reasons known only to the author. */ | |
54 | case 14: | |
55 | bar (14); | |
56 | break; | |
7bad794a JJ |
57 | case 15: |
58 | bar (15); /* { dg-bogus "this statement may \[laf]* through" } */ | |
59 | /*-fallthrough*/ | |
60 | case 16: | |
61 | bar (16); | |
62 | break; | |
63 | case 17: | |
64 | bar (17); /* { dg-bogus "this statement may \[laf]* through" } */ | |
65 | /*@fallthrough@*/ | |
66 | case 18: | |
67 | bar (18); | |
68 | break; | |
81b02905 JJ |
69 | case 19: |
70 | bar (19); /* { dg-bogus "this statement may \[laf]* through" } */ | |
71 | /*lint -fallthrough*/ | |
72 | case 20: | |
73 | bar (20); | |
74 | break; | |
75 | case 21: | |
76 | bar (21); /* { dg-bogus "this statement may \[laf]* through" } */ | |
77 | /*lint -fallthrough */ | |
78 | case 22: | |
79 | bar (22); | |
80 | break; | |
7bad794a JJ |
81 | case 23: |
82 | bar (23); /* { dg-bogus "this statement may \[laf]* through" } */ | |
83 | /*fallthru*/ | |
84 | case 24: | |
85 | bar (24); | |
86 | break; | |
81b02905 JJ |
87 | case 25: |
88 | bar (25); /* { dg-bogus "this statement may \[laf]* through" } */ | |
89 | /*Else fallthru*/ | |
90 | case 26: | |
91 | bar (26); | |
92 | break; | |
93 | case 27: | |
94 | bar (27); /* { dg-bogus "this statement may \[laf]* through" } */ | |
95 | /*Intentional fallthru*/ | |
96 | case 28: | |
97 | bar (28); | |
98 | break; | |
99 | case 29: | |
100 | bar (29); /* { dg-bogus "this statement may \[laf]* through" } */ | |
101 | /*Intentionally fallthru*/ | |
102 | case 30: | |
103 | bar (30); | |
104 | break; | |
7bad794a JJ |
105 | case 31: |
106 | bar (31); /* { dg-bogus "this statement may \[laf]* through" } */ | |
107 | /*Falls thru*/ | |
108 | case 32: | |
109 | bar (32); | |
110 | break; | |
111 | case 33: | |
112 | bar (33); /* { dg-bogus "this statement may \[laf]* through" } */ | |
113 | /*Fall-through*/ | |
114 | case 34: | |
115 | bar (34); | |
116 | break; | |
117 | default: | |
118 | break; | |
119 | } | |
120 | switch (i) | |
121 | { | |
122 | case 1: | |
123 | bar (1); /* { dg-bogus "this statement may \[laf]* through" } */ | |
124 | // FALLTHROUGH | |
125 | case 2: | |
126 | bar (2); | |
127 | break; | |
128 | case 3: | |
129 | bar (3); /* { dg-bogus "this statement may \[laf]* through" } */ | |
130 | // FALLS THRU. | |
131 | // Some other comment. | |
132 | case 4: | |
133 | bar (4); | |
134 | break; | |
81b02905 JJ |
135 | case 5: |
136 | bar (5); /* { dg-bogus "this statement may \[laf]* through" } */ | |
137 | // Else Fall-Thru! | |
138 | case 6: | |
139 | bar (6); | |
140 | break; | |
7bad794a JJ |
141 | case 7: |
142 | bar (7); /* { dg-bogus "this statement may \[laf]* through" } */ | |
143 | // Some comment. | |
81b02905 | 144 | // ... fallthrough ... |
7bad794a JJ |
145 | // Some other comment. |
146 | // And yet another. | |
147 | case 8: | |
148 | bar (8); | |
149 | break; | |
81b02905 JJ |
150 | case 9: |
151 | bar (9); /* { dg-bogus "this statement may \[laf]* through" } */ | |
152 | // Intentional Fallthru | |
153 | case 10: | |
154 | bar (10); | |
155 | break; | |
156 | case 11: | |
157 | bar (11); /* { dg-bogus "this statement may \[laf]* through" } */ | |
158 | // intentionally fall through | |
159 | case 12: | |
160 | bar (12); | |
161 | break; | |
162 | case 13: | |
163 | bar (13); /* { dg-bogus "this statement may \[laf]* through" } */ | |
164 | // Falls Through - for reasons known only to the author. | |
165 | case 14: | |
166 | bar (14); | |
167 | break; | |
7bad794a JJ |
168 | case 15: |
169 | bar (15); /* { dg-bogus "this statement may \[laf]* through" } */ | |
170 | //-fallthrough | |
171 | case 16: | |
172 | bar (16); | |
173 | break; | |
174 | case 17: | |
175 | bar (17); /* { dg-bogus "this statement may \[laf]* through" } */ | |
176 | //@fallthrough@ | |
177 | case 18: | |
178 | bar (18); | |
179 | break; | |
81b02905 JJ |
180 | case 19: |
181 | bar (19); /* { dg-bogus "this statement may \[laf]* through" } */ | |
182 | //lint -fallthrough | |
183 | case 20: | |
184 | bar (20); | |
185 | break; | |
186 | case 21: | |
187 | bar (21); /* { dg-bogus "this statement may \[laf]* through" } */ | |
188 | //lint -fallthrough | |
189 | case 22: | |
190 | bar (22); | |
191 | break; | |
7bad794a JJ |
192 | case 23: |
193 | bar (23); /* { dg-bogus "this statement may \[laf]* through" } */ | |
194 | //fallthru | |
195 | case 24: | |
196 | bar (24); | |
197 | break; | |
81b02905 JJ |
198 | case 25: |
199 | bar (25); /* { dg-bogus "this statement may \[laf]* through" } */ | |
200 | //Else fallthru | |
201 | case 26: | |
202 | bar (26); | |
203 | break; | |
204 | case 27: | |
205 | bar (27); /* { dg-bogus "this statement may \[laf]* through" } */ | |
206 | //Intentional fallthru | |
207 | case 28: | |
208 | bar (28); | |
209 | break; | |
210 | case 29: | |
211 | bar (29); /* { dg-bogus "this statement may \[laf]* through" } */ | |
212 | //Intentionally fallthru | |
213 | case 30: | |
214 | bar (30); | |
215 | break; | |
7bad794a JJ |
216 | case 31: |
217 | bar (31); /* { dg-bogus "this statement may \[laf]* through" } */ | |
218 | //Falls thru | |
219 | case 32: | |
220 | bar (32); | |
221 | break; | |
222 | case 33: | |
223 | bar (33); /* { dg-bogus "this statement may \[laf]* through" } */ | |
224 | //Fall-through | |
225 | case 34: | |
226 | bar (34); | |
227 | break; | |
228 | default: | |
229 | break; | |
230 | } | |
231 | } |