1 // RUN: %clang_cc1 -Wdeprecated %s -fsyntax-only -verify
3 // expected-error@+1{{expected (}}
4 #pragma clang deprecated
6 // expected-error@+1{{expected identifier}}
7 #pragma clang deprecated(4
9 // expected-error@+1{{no macro named 'foo'}}
10 #pragma clang deprecated(foo)
13 // expected-note@+1{{macro marked 'deprecated' here}}
14 #pragma clang deprecated(bar, "bar is deprecated use 1")
16 // expected-warning@+1{{macro 'bar' has been marked as deprecated: bar is deprecated use 1}}
21 // expected-note@+8{{macro marked 'deprecated' here}}
22 // expected-note@+7{{macro marked 'deprecated' here}}
23 // expected-note@+6{{macro marked 'deprecated' here}}
24 // expected-note@+5{{macro marked 'deprecated' here}}
25 // expected-note@+4{{macro marked 'deprecated' here}}
26 // expected-note@+3{{macro marked 'deprecated' here}}
27 // expected-note@+2{{macro marked 'deprecated' here}}
28 // expected-note@+1{{macro marked 'deprecated' here}}
29 #pragma clang deprecated(foo)
31 // expected-error@+1{{expected )}}
32 #pragma clang deprecated(foo
34 // expected-warning@+1{{macro 'foo' has been marked as deprecated}}
38 // expected-warning@+1{{macro 'foo' has been marked as deprecated}}
42 // expected-warning@+1{{macro 'foo' has been marked as deprecated}}
46 // expected-warning@+1{{macro 'foo' has been marked as deprecated}}
50 int main(int argc
, char** argv
) {
51 // expected-error@+1{{no macro named 'main'}}
52 #pragma clang deprecated(main)
54 // expected-warning@+1{{macro 'foo' has been marked as deprecated}}
59 #pragma clang deprecated(frobble)
61 // not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}
62 #undef frobble // Expect no diagnostics here
64 // not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}
65 #define frobble 1 // How about here given that this was undefined?
67 // not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}
71 // Test that we diagnose on #elif.
74 // expected-warning@-1{{macro 'foo' has been marked as deprecated}}
78 // Test that we diagnose on #elifdef.
81 // expected-warning@-1{{macro 'foo' has been marked as deprecated}}
82 // expected-warning@-2{{use of a '#elifdef' directive is a C2x extension}}
85 // Test that we diagnose on #elifndef.
89 // expected-warning@-2{{macro 'foo' has been marked as deprecated}}
90 // expected-warning@-3{{use of a '#elifndef' directive is a C2x extension}}
92 // FIXME: These cases are currently not handled because clang doesn't expand
93 // conditions on skipped #elif* blocks. See the FIXME notes in
94 // Preprocessor::SkipExcludedConditionalBlock.
97 // not-expected-warning@+2{{macro 'foo' has been marked as deprecated}}
98 // expected-warning@+1{{use of a '#elifndef' directive is a C2x extension}}
103 // not-expected-warning@+2{{macro 'foo' has been marked as deprecated}}
104 // expected-warning@+1{{use of a '#elifdef' directive is a C2x extension}}
109 // not-expected-warning@+1{{macro 'foo' has been marked as deprecated}}