1 // RUN: %clang_cc1 %s -Eonly -verify
3 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
6 #error "did not expect to get here"
9 /* expected-error@+5 {{"got it"}} */
10 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
17 /* expected-error@+4 {{"got it"}} */
18 /* expected-warning@+2 {{use of a '#elifndef' directive is a C2x extension}} */
24 /* expected-error@+4 {{"got it"}} */
25 /* expected-warning@+2 {{use of a '#elifndef' directive is a C2x extension}} */
30 #error "did not expect to get here"
34 /* expected-error@+4 {{"got it"}} */
35 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
42 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
44 #elifdef BAR // test that comments aren't an issue
45 #error "did not expect to get here"
48 /* expected-error@+5 {{"got it"}} */
49 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
51 #elifdef BAR // test that comments aren't an issue
56 /* expected-error@+4 {{"got it"}} */
57 /* expected-warning@+2 {{use of a '#elifndef' directive is a C2x extension}} */
59 #elifndef BAR // test that comments aren't an issue
63 /* expected-error@+4 {{"got it"}} */
64 /* expected-warning@+2 {{use of a '#elifndef' directive is a C2x extension}} */
66 #elifndef BAR // test that comments aren't an issue
69 #error "did not expect to get here"
73 /* expected-error@+4 {{"got it"}} */
74 /* expected-warning@+2 {{use of a '#elifdef' directive is a C2x extension}} */
76 #elifdef BAR // test that comments aren't an issue
82 /* expected-error@+7 {{"got it"}} */
83 /* expected-warning@+3 {{use of a '#elifndef' directive is a C2x extension}} */
85 #error "did not expect to get here"
87 #error "did not expect to get here"
93 /* expected-error@+4 {{#elifdef after #else}} */
94 /* expected-warning@+3 {{use of a '#elifdef' directive is a C2x extension}} */
100 /* expected-error@+4 {{#elifndef after #else}} */
101 /* expected-warning@+3 {{use of a '#elifndef' directive is a C2x extension}} */
107 /* expected-warning@+1 {{use of a '#elifdef' directive is a C2x extension}} */
108 #elifdef FOO /* expected-error {{#elifdef without #if}} */
109 #endif /* expected-error {{#endif without #if}} */
111 /* expected-warning@+1 {{use of a '#elifndef' directive is a C2x extension}} */
112 #elifndef FOO /* expected-error {{#elifndef without #if}} */
113 #endif /* expected-error {{#endif without #if}} */
115 /* Note, we do not expect errors about the missing macro name in the skipped
116 blocks. This is consistent with #elif behavior. */
117 /* expected-error@+4 {{"got it"}} */
118 /* expected-warning@+4 {{use of a '#elifdef' directive is a C2x extension}} */
119 /* expected-warning@+4 {{use of a '#elifndef' directive is a C2x extension}} */
126 /* expected-error@+3 {{#elif after #else}}*/