1 // RUN: %clang_cc1 %s -Eonly -verify
3 /* expected-warning@+2 {{use of a '#elifdef' directive is a C23 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 C23 extension}} */
17 /* expected-error@+4 {{"got it"}} */
18 /* expected-warning@+2 {{use of a '#elifndef' directive is a C23 extension}} */
24 /* expected-error@+4 {{"got it"}} */
25 /* expected-warning@+2 {{use of a '#elifndef' directive is a C23 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 C23 extension}} */
42 /* expected-warning@+2 {{use of a '#elifdef' directive is a C23 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 C23 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 C23 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 C23 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 C23 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 C23 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 C23 extension}} */
100 /* expected-error@+4 {{#elifndef after #else}} */
101 /* expected-warning@+3 {{use of a '#elifndef' directive is a C23 extension}} */
107 /* expected-warning@+1 {{use of a '#elifdef' directive is a C23 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 C23 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 C23 extension}} */
119 /* expected-warning@+4 {{use of a '#elifndef' directive is a C23 extension}} */
126 /* expected-error@+3 {{#elif after #else}}*/