| 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 |
*/ |
| 9 |
|
| 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 |
| 12 |
*/ |
| 13 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 %s |
| 14 |
*/ |
| 15 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c89 -Wall %s |
| 16 |
*/ |
| 17 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c99 -Wall -pedantic %s |
| 18 |
*/ |
| 19 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -std=c11 -Wall -pedantic %s |
| 20 |
*/ |
| 21 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ %s |
| 22 |
*/ |
| 23 |
/* RUN: %clang_cc1 -fsyntax-only -verify=none -x c++ -Wdeclaration-after-statement %s |
| 24 |
*/ |
| 25 |
|
| 26 |
/* none-no-diagnostics */ |
| 27 |
|
| 28 |
int foo(int i) |
| 29 |
{ |
| 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; |
| 38 |
} |