Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -Eonly -verify |
Reid Spencer | 5f016e2 | 2007-07-11 17:01:13 +0000 | [diff] [blame] | 2 | |
| 3 | #pragma GCC poison rindex |
Chris Lattner | bf60445 | 2009-04-19 20:15:59 +0000 | [diff] [blame] | 4 | rindex(some_string, 'h'); // expected-error {{attempt to use a poisoned identifier}} |
| 5 | |
| 6 | #define BAR _Pragma ("GCC poison XYZW") XYZW /*NO ERROR*/ |
| 7 | XYZW // ok |
| 8 | BAR |
| 9 | XYZW // expected-error {{attempt to use a poisoned identifier}} |
| 10 | |
| 11 | // Pragma poison shouldn't warn from macro expansions defined before the token |
| 12 | // is poisoned. |
| 13 | |
| 14 | #define strrchr rindex2 |
| 15 | #pragma GCC poison rindex2 |
| 16 | |
| 17 | // Can poison multiple times. |
| 18 | #pragma GCC poison rindex2 |
| 19 | |
| 20 | strrchr(some_string, 'h'); // ok. |