gcc/testsuite/c-c++-common/Wimplicit-fallthrough-15.c
raw| 1 | /* PR c/7652 */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-Wimplicit-fallthrough" } */ |
| 4 | |
| 5 | /* Another nested switch. Check that we don't warn here. */ |
| 6 | |
| 7 | void |
| 8 | f (int i) |
| 9 | { |
| 10 | int j = 0; |
| 11 | switch (i) |
| 12 | { |
| 13 | case 0: |
| 14 | case 1: |
| 15 | j = 10; |
| 16 | __attribute__((fallthrough)); |
| 17 | case 2: |
| 18 | j += 10; |
| 19 | break; |
| 20 | case 3: |
| 21 | switch (i) |
| 22 | { |
| 23 | case 5: |
| 24 | j += 2; |
| 25 | __attribute__((fallthrough)); |
| 26 | case 6: |
| 27 | j += 4; |
| 28 | break; |
| 29 | } |
| 30 | } |
| 31 | } |