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-cpp2b-pedantic -pedantic %s
10 // RUN: %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify=pre-cpp2b-compat -Wpre-c++2b-compat %s
11 // RUN: not %clang_cc1 -x c++ -fsyntax-only -verify %s
12 // RUN: not %clang_cc1 -x c++ -std=c++2b -fsyntax-only -verify -pedantic %s
13 // RUN: not %clang_cc1 -x c++ -std=c++2b -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 C2x extension}}
22 // pre-c2x-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C standards before C2x}}
23 
24 // For C++
25 // pre-cpp2b-pedantic-warning@#1 {{use of a '#elifdef' directive is a C++2b extension}}
26 // pre-cpp2b-compat-warning@#1 {{use of a '#elifdef' directive is incompatible with C++ standards before C++2b}}
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 C2x extension}}
33 // pre-c2x-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C standards before C2x}}
34 
35 // For C++
36 // pre-cpp2b-pedantic-warning@#2 {{use of a '#elifndef' directive is a C++2b extension}}
37 // pre-cpp2b-compat-warning@#2 {{use of a '#elifndef' directive is incompatible with C++ standards before C++2b}}
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 C2x extension}}
44 // pre-c2x-compat-warning@-4 {{use of a '#elifdef' directive is incompatible with C standards before C2x}}
45 
46 // For C++
47 // pre-cpp2b-pedantic-warning@-7 {{use of a '#elifdef' directive is a C++2b extension}}
48 // pre-cpp2b-compat-warning@-8 {{use of a '#elifdef' directive is incompatible with C++ standards before C++2b}}
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 C2x extension}}
55 // pre-c2x-compat-warning@-4 {{use of a '#elifndef' directive is incompatible with C standards before C2x}}
56 
57 // For C++
58 // pre-cpp2b-pedantic-warning@-7 {{use of a '#elifndef' directive is a C++2b extension}}
59 // pre-cpp2b-compat-warning@-8 {{use of a '#elifndef' directive is incompatible with C++ standards before C++2b}}
60