xref: /llvm-project/clang/test/Sema/warn-unreachable-fallthrough.c (revision de401ac2a4ab74392b8234aa3a517481a1e2762c)
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c2x -Wunreachable-code-fallthrough %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c2x -Wunreachable-code %s
3 // RUN: %clang_cc1 -fsyntax-only -verify=code -std=c2x -Wunreachable-code -Wno-unreachable-code-fallthrough %s
4 // RUN: %clang_cc1 -fsyntax-only -verify -std=c2x -Wno-unreachable-code -Wunreachable-code-fallthrough %s
5 
6 int n;
f(void)7 void f(void){
8      switch (n){
9          [[fallthrough]]; // expected-warning{{fallthrough annotation in unreachable code}}
10                           // code-warning@-1{{never be executed}}
11          case 1:;
12      }
13 }
14