ident-0b.c: Also skip on 32-bit hppa*-*-hpux*.
[gcc.git] / gcc / testsuite / c-c++-common / Wimplicit-fallthrough-2.c
1 /* PR c/7652 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wimplicit-fallthrough" } */
4
5 extern void bar (int);
6
7 /* Test if without else. */
8
9 void
10 f (int i)
11 {
12 switch (i)
13 {
14 case 1:
15 if (i) /* { dg-warning "statement may fall through" } */
16 bar (1);
17 case 2:
18 __builtin_abort ();
19 }
20
21 switch (i)
22 {
23 case 1:
24 if (i) /* { dg-warning "statement may fall through" } */
25 return;
26 case 2:
27 __builtin_abort ();
28 }
29
30 switch (i)
31 {
32 case 1:
33 if (i)
34 bar (1);
35 break;
36 case 2:
37 __builtin_abort ();
38 }
39
40 switch (i)
41 {
42 case 1:
43 if (i)
44 return;
45 break;
46 case 2:
47 __builtin_abort ();
48 }
49
50 switch (i)
51 {
52 case 1:
53 if (i) /* { dg-warning "statement may fall through" } */
54 goto L1;
55 case 2:
56 L1:
57 __builtin_abort ();
58 }
59
60 switch (i)
61 {
62 case 1:
63 if (i) /* { dg-warning "statement may fall through" } */
64 goto L2;
65 L2:
66 case 2:
67 __builtin_abort ();
68 }
69
70 switch (i)
71 {
72 case 1:
73 if (i)
74 goto L3;
75 break;
76 case 2:
77 L3:
78 __builtin_abort ();
79 }
80
81 switch (i)
82 {
83 case 1:
84 if (i)
85 goto L4;
86 break;
87 L4:
88 case 2:
89 __builtin_abort ();
90 }
91
92 switch (i)
93 {
94 case 1:
95 if (i) /* { dg-warning "statement may fall through" } */
96 if (i > 9)
97 bar (1);
98 case 2:
99 __builtin_abort ();
100 }
101
102 switch (i)
103 {
104 case 1:
105 if (i)
106 if (i > 9)
107 bar (1);
108 break;
109 case 2:
110 __builtin_abort ();
111 }
112
113 switch (i)
114 {
115 case 1:
116 { int a; }
117 {
118 if (i) /* { dg-warning "statement may fall through" } */
119 if (i > 9)
120 bar (1);
121 }
122 case 2:
123 __builtin_abort ();
124 }
125
126 switch (i)
127 {
128 case 1:
129 if (i)
130 bar (1);
131 bar (2); /* { dg-warning "statement may fall through" } */
132 case 2:
133 __builtin_abort ();
134 }
135
136 switch (i)
137 {
138 case 1:
139 if (i)
140 bar (1);
141 bar (2);
142 break;
143 case 2:
144 __builtin_abort ();
145 }
146
147 switch (i)
148 {
149 case 1:
150 if (i)
151 return;
152 bar (2); /* { dg-warning "statement may fall through" } */
153 case 2:
154 __builtin_abort ();
155 }
156
157 switch (i)
158 {
159 case 1:
160 if (i)
161 return;
162 bar (2);
163 break;
164 case 2:
165 __builtin_abort ();
166 }
167
168 switch (i)
169 {
170 case 1:
171 if (i)
172 bar (1);
173 if (i)
174 bar (2);
175 if (i)
176 bar (3);
177 bar (4); /* { dg-warning "statement may fall through" } */
178 case 2:
179 __builtin_abort ();
180 }
181
182 switch (i)
183 {
184 case 1:
185 if (i)
186 bar (1);
187 if (i)
188 bar (2);
189 if (i) /* { dg-warning "statement may fall through" } */
190 bar (3);
191 case 2:
192 __builtin_abort ();
193 }
194
195 switch (i)
196 {
197 case 1:
198 if (i)
199 bar (1);
200 if (i)
201 bar (2);
202 if (i)
203 bar (3);
204 bar (4);
205 break;
206 case 2:
207 __builtin_abort ();
208 }
209
210 switch (i)
211 {
212 case 1:
213 if (i)
214 bar (1);
215 if (i)
216 bar (2);
217 if (i)
218 bar (3);
219 break;
220 case 2:
221 __builtin_abort ();
222 }
223 }