Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Sema / warn-mixed-decls.c
blobb8a7dc1e2bc09fa4df19bd28ff196e81f89a36e1
1 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -pedantic %s
2 */
3 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c89 -Wdeclaration-after-statement %s
4 */
5 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c99 -Wdeclaration-after-statement %s
6 */
7 /* RUN: %clang_cc1 -fsyntax-only -verify -std=c11 -Wdeclaration-after-statement %s
8 */
10 /* Should not emit diagnostic when not pedantic, not enabled or in C++ Code*/
11 /* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c89 %s
13 /* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 %s
15 /* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c89 -Wall %s
17 /* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 -Wall -pedantic %s
19 /* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c11 -Wall -pedantic %s
21 /* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ %s
23 /* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ -Wdeclaration-after-statement %s
26 /* none-no-diagnostics */
28 int foo(int i)
30 i += 1;
31 int f = i;
32 #if __STDC_VERSION__ < 199901L
33 /* expected-warning@-2 {{mixing declarations and code is a C99 extension}}*/
34 #else
35 /* expected-warning@-4 {{mixing declarations and code is incompatible with standards before C99}}*/
36 #endif
37 return f;