| 1 |
/* PR c/7652 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Wimplicit-fallthrough" } */ |
| 4 |
|
| 5 |
/* Testing some loops. */ |
| 6 |
|
| 7 |
int f (void); |
| 8 |
|
| 9 |
int |
| 10 |
g (int i) |
| 11 |
{ |
| 12 |
switch (i) |
| 13 |
{ |
| 14 |
case 0: |
| 15 |
for (;;) |
| 16 |
{ |
| 17 |
if (f ()) /* { dg-warning "statement may fall through" "fall through" { xfail *-*-* } } */ |
| 18 |
break; |
| 19 |
} |
| 20 |
case 1: |
| 21 |
return 1; |
| 22 |
} |
| 23 |
return 0; |
| 24 |
} |
| 25 |
|
| 26 |
int |
| 27 |
h (int i) |
| 28 |
{ |
| 29 |
switch (i) |
| 30 |
{ |
| 31 |
case 0: |
| 32 |
do |
| 33 |
{ |
| 34 |
if (f ()) /* { dg-warning "statement may fall through" } */ |
| 35 |
break; |
| 36 |
} |
| 37 |
while (0); |
| 38 |
case 1: |
| 39 |
return 1; |
| 40 |
} |
| 41 |
return 0; |
| 42 |
} |