xref: /minix3/external/bsd/llvm/dist/clang/test/Preprocessor/pragma_poison.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -Eonly -verify
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc #pragma GCC poison rindex
4*f4a2713aSLionel Sambuc rindex(some_string, 'h');   // expected-error {{attempt to use a poisoned identifier}}
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc #define BAR _Pragma ("GCC poison XYZW")  XYZW /*NO ERROR*/
7*f4a2713aSLionel Sambuc   XYZW      // ok
8*f4a2713aSLionel Sambuc BAR
9*f4a2713aSLionel Sambuc   XYZW      // expected-error {{attempt to use a poisoned identifier}}
10*f4a2713aSLionel Sambuc 
11*f4a2713aSLionel Sambuc // Pragma poison shouldn't warn from macro expansions defined before the token
12*f4a2713aSLionel Sambuc // is poisoned.
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc #define strrchr rindex2
15*f4a2713aSLionel Sambuc #pragma GCC poison rindex2
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc // Can poison multiple times.
18*f4a2713aSLionel Sambuc #pragma GCC poison rindex2
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc strrchr(some_string, 'h');   // ok.
21