Mercurial > hg > CbC > CbC_gcc
diff gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gcc/testsuite/c-c++-common/Wimplicit-fallthrough-29.c Fri Oct 27 22:46:09 2017 +0900 @@ -0,0 +1,33 @@ +/* { dg-do compile } */ +/* { dg-options "-Wimplicit-fallthrough=3" } */ + +void bar (int); + +void +foo (int i) +{ + switch (i) + { + case 1: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (1); + case 2: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (2); + /* Some comment. */ + case 3: /* { dg-warning "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (3); + /* Here we really do want to fALl tHRoUgh and we mean it! */ + case 4: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (4); + /* Intentionally fall through. */ + case 5: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (5); + /* FALLTHROUGH */ + case 6: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (6); + __attribute__((fallthrough)); + case 7: /* { dg-bogus "this statement may \[fla\]* through" "" { target *-*-* } .+1 } */ + bar (7); + default: + break; + } +}