| 1 |
// For C |
| 2 |
// RUN: %clang_cc1 -std=c99 -fsyntax-only -verify=pre-c2x-pedantic -pedantic %s |
| 3 |
// RUN: %clang_cc1 -std=c2x -fsyntax-only -verify=pre-c2x-compat -Wpre-c2x-compat %s |
| 4 |
// RUN: not %clang_cc1 -std=c99 -fsyntax-only -verify %s |
| 5 |
// RUN: not %clang_cc1 -std=c2x -fsyntax-only -verify -pedantic %s |
| 6 |
// RUN: not %clang_cc1 -std=c2x -fsyntax-only -verify %s |
| 7 |
|
| 8 |
// For C++ |
| 9 |
// RUN: %clang_cc1 -x c++ -fsyntax-only -verify=pre-cpp23-pedantic -pedantic %s |
| 10 |
// RUN: %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify=pre-cpp23-compat -Wpre-c++23-compat %s |
| 11 |
// RUN: not %clang_cc1 -x c++ -fsyntax-only -verify %s |
| 12 |
// RUN: not %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify -pedantic %s |
| 13 |
// RUN: not %clang_cc1 -x c++ -std=c++23 -fsyntax-only -verify %s |
| 14 |
|
| 15 |
int x; |
| 16 |
|
| 17 |
#if 1 |
| 18 |
#elifdef A // #1 |
| 19 |
#endif |
| 20 |
// For C |
| 21 |
// pre-c2x-pedantic-warning@#1 {{use of a '#elifdef' directive is a C23 extension}} |
| 22 |
// pre-c2x-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C standards before C23}} |
| 23 |
|
| 24 |
// For C++ |
| 25 |
// pre-cpp23-pedantic-warning@#1 {{use of a '#elifdef' directive is a C++23 extension}} |
| 26 |
// pre-cpp23-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C++ standards before C++23}} |
| 27 |
|
| 28 |
#if 1 |
| 29 |
#elifndef B // #2 |
| 30 |
#endif |
| 31 |
// For C |
| 32 |
// pre-c2x-pedantic-warning@#2 {{use of a '#elifndef' directive is a C23 extension}} |
| 33 |
// pre-c2x-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C standards before C23}} |
| 34 |
|
| 35 |
// For C++ |
| 36 |
// pre-cpp23-pedantic-warning@#2 {{use of a '#elifndef' directive is a C++23 extension}} |
| 37 |
// pre-cpp23-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C++ standards before C++23}} |
| 38 |
|
| 39 |
#if 0 |
| 40 |
#elifdef C |
| 41 |
#endif |
| 42 |
// For C |
| 43 |
// pre-c2x-pedantic-warning@-3 {{use of a '#elifdef' directive is a C23 extension}} |
| 44 |
// pre-c2x-compat-warning@-4 {{use of a '#elifdef' directive is incompatible with C standards before C23}} |
| 45 |
|
| 46 |
// For C++ |
| 47 |
// pre-cpp23-pedantic-warning@-7 {{use of a '#elifdef' directive is a C++23 extension}} |
| 48 |
// pre-cpp23-compat-warning@-8 {{use of a '#elifdef' directive is incompatible with C++ standards before C++23}} |
| 49 |
|
| 50 |
#if 0 |
| 51 |
#elifndef D |
| 52 |
#endif |
| 53 |
// For C |
| 54 |
// pre-c2x-pedantic-warning@-3 {{use of a '#elifndef' directive is a C23 extension}} |
| 55 |
// pre-c2x-compat-warning@-4 {{use of a '#elifndef' directive is incompatible with C standards before C23}} |
| 56 |
|
| 57 |
// For C++ |
| 58 |
// pre-cpp23-pedantic-warning@-7 {{use of a '#elifndef' directive is a C++23 extension}} |
| 59 |
// pre-cpp23-compat-warning@-8 {{use of a '#elifndef' directive is incompatible with C++ standards before C++23}} |
| 60 |
|
| 61 |
#warning foo |
| 62 |
// For C |
| 63 |
// pre-c2x-pedantic-warning@-2 {{#warning is a C23 extension}} |
| 64 |
// pre-c2x-pedantic-warning@-3 {{foo}} |
| 65 |
// pre-c2x-compat-warning@-4 {{#warning is incompatible with C standards before C23}} |
| 66 |
// pre-c2x-compat-warning@-5 {{foo}} |
| 67 |
|
| 68 |
// For C++ |
| 69 |
// pre-cpp23-pedantic-warning@-8 {{#warning is a C++23 extension}} |
| 70 |
// pre-cpp23-pedantic-warning@-9 {{foo}} |
| 71 |
// pre-cpp23-compat-warning@-10 {{#warning is incompatible with C++ standards before C++23}} |
| 72 |
// pre-cpp23-compat-warning@-11 {{foo}} |