[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Lexer / final-macro.c
blob2992714dd8a5aa1f23e767b04d94ad306643091a
1 // RUN: %clang_cc1 -Wfinal-macro %s -fsyntax-only -isystem %S/Inputs -verify
3 // Test warning production
4 #define Foo 1
5 // expected-note@+1 4{{macro marked 'final' here}}
6 #pragma clang final(Foo)
8 // expected-warning@+2{{macro 'Foo' has been marked as final and should not be redefined}}
9 // expected-note@+1{{previous definition is here}}
10 #define Foo 1
12 // expected-warning@+2{{macro 'Foo' has been marked as final and should not be redefined}}
13 // expected-warning@+1{{'Foo' macro redefined}}
14 #define Foo 2
16 // expected-warning@+1{{redefining builtin macro}}
17 #define __TIME__ 1
19 // expected-warning@+1{{undefining builtin macro}}
20 #undef __TIMESTAMP__
22 // expected-warning@+1{{macro 'Foo' has been marked as final and should not be undefined}}
23 #undef Foo
24 // expected-warning@+1{{macro 'Foo' has been marked as final and should not be redefined}}
25 #define Foo 3
27 // Test parse errors
28 // expected-error@+1{{expected (}}
29 #pragma clang final
31 // expected-error@+1{{expected )}}
32 #pragma clang final(Foo
34 // expected-error@+1{{no macro named 'Baz'}}
35 #pragma clang final(Baz)
37 // expected-error@+1{{expected identifier}}
38 #pragma clang final(4)
40 // expected-error@+1{{expected (}}
41 #pragma clang final Baz
43 // no diagnostics triggered by these pragmas.
44 #pragma clang deprecated(Foo)
45 #pragma clang restrict_expansion(Foo)
47 #define SYSTEM_MACRO Woah
48 // expected-note@+1 2{{macro marked 'final' here}}
49 #pragma clang final(SYSTEM_MACRO)
50 #include <final-macro-system.h>