pragma_poison.c 547 B

1234567891011121314151617181920
  1. // RUN: %clang_cc1 %s -Eonly -verify
  2. #pragma GCC poison rindex
  3. rindex(some_string, 'h'); // expected-error {{attempt to use a poisoned identifier}}
  4. #define BAR _Pragma ("GCC poison XYZW") XYZW /*NO ERROR*/
  5. XYZW // ok
  6. BAR
  7. XYZW // expected-error {{attempt to use a poisoned identifier}}
  8. // Pragma poison shouldn't warn from macro expansions defined before the token
  9. // is poisoned.
  10. #define strrchr rindex2
  11. #pragma GCC poison rindex2
  12. // Can poison multiple times.
  13. #pragma GCC poison rindex2
  14. strrchr(some_string, 'h'); // ok.