PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / Wimplicit-fallthrough-4.c
blob9a0aeb753d92bc755b5efcff1311bdadb85a5412
1 /* PR c/7652 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wimplicit-fallthrough" } */
5 extern void bar (int);
7 /* Test if with more elses. */
9 void
10 f (int i)
12 switch (i)
14 case 1:
15 if (i > 5) /* { dg-warning "statement may fall through" } */
16 bar (1);
17 else if (i > 10)
18 bar (2);
19 else if (i > 15)
20 bar (3);
21 case 2:
22 __builtin_abort ();
25 switch (i)
27 case 1:
28 if (i > 5) /* { dg-warning "statement may fall through" } */
29 bar (1);
30 else if (i > 10)
31 bar (2);
32 else if (i > 15)
33 bar (3);
34 else
35 bar (4);
36 case 2:
37 __builtin_abort ();
40 switch (i)
42 case 1:
43 if (i > 5)
44 return;
45 else if (i > 10) /* { dg-warning "statement may fall through" } */
46 bar (2);
47 else if (i > 15)
48 bar (3);
49 case 2:
50 __builtin_abort ();
53 switch (i)
55 case 1:
56 if (i > 5)
57 return;
58 else if (i > 10) /* { dg-warning "statement may fall through" } */
59 bar (2);
60 else if (i > 15)
61 bar (3);
62 else
63 bar (4);
64 case 2:
65 __builtin_abort ();
68 switch (i)
70 case 1:
71 if (i > 5) /* { dg-warning "statement may fall through" } */
72 bar (1);
73 else if (i > 10)
74 return;
75 else if (i > 15)
76 bar (3);
77 case 2:
78 __builtin_abort ();
81 switch (i)
83 case 1:
84 if (i > 5) /* { dg-warning "statement may fall through" } */
85 bar (1);
86 else if (i > 10)
87 return;
88 else if (i > 15)
89 bar (3);
90 else
91 bar (4);
92 case 2:
93 __builtin_abort ();
96 switch (i)
98 case 1:
99 if (i > 5) /* { dg-warning "statement may fall through" } */
100 bar (1);
101 else if (i > 10)
102 bar (4);
103 else if (i > 15)
104 return;
105 case 2:
106 __builtin_abort ();
109 switch (i)
111 case 1:
112 if (i > 5) /* { dg-warning "statement may fall through" } */
113 bar (1);
114 else if (i > 10)
115 bar (4);
116 else if (i > 15)
117 return;
118 else
119 bar (4);
120 case 2:
121 __builtin_abort ();
124 switch (i)
126 case 1:
127 if (i > 5)
128 return;
129 else if (i > 10)
130 return;
131 else if (i > 15) /* { dg-warning "statement may fall through" } */
132 bar (3);
133 case 2:
134 __builtin_abort ();
137 switch (i)
139 case 1:
140 if (i > 5)
141 return;
142 else if (i > 10)
143 return;
144 else if (i > 15) /* { dg-warning "statement may fall through" } */
145 bar (3);
146 else
147 bar (4);
148 case 2:
149 __builtin_abort ();
152 switch (i)
154 case 1:
155 if (i > 5)
156 return;
157 else if (i > 10) /* { dg-warning "statement may fall through" } */
158 bar (2);
159 else if (i > 15)
160 return;
161 case 2:
162 __builtin_abort ();
165 switch (i)
167 case 1:
168 if (i > 5)
169 return;
170 else if (i > 10) /* { dg-warning "statement may fall through" } */
171 bar (2);
172 else if (i > 15)
173 return;
174 else
175 bar (4);
176 case 2:
177 __builtin_abort ();
180 switch (i)
182 case 1:
183 if (i > 5) /* { dg-warning "statement may fall through" } */
184 bar (1);
185 else if (i > 10)
186 return;
187 else if (i > 15)
188 return;
189 case 2:
190 __builtin_abort ();
193 switch (i)
195 case 1:
196 if (i > 5) /* { dg-warning "statement may fall through" } */
197 bar (1);
198 else if (i > 10)
199 return;
200 else if (i > 15)
201 return;
202 else
203 bar (4);
204 case 2:
205 __builtin_abort ();
208 switch (i)
210 case 1:
211 if (i > 5)
212 return;
213 else if (i > 10)
214 return;
215 else if (i > 15) /* { dg-warning "statement may fall through" } */
216 return;
217 case 2:
218 __builtin_abort ();
221 switch (i)
223 case 1:
224 if (i > 5)
225 return;
226 else if (i > 10)
227 return;
228 else if (i > 15)
229 return;
230 else
231 bar (4); /* { dg-warning "statement may fall through" } */
232 case 2:
233 __builtin_abort ();
236 switch (i)
238 case 1:
239 if (i > 5)
240 return;
241 else if (i > 10)
242 return;
243 else if (i > 15)
244 return;
245 else
246 return;
247 case 2:
248 __builtin_abort ();