1// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++98 %s 2 3#define for 0 // expected-warning {{keyword is hidden by macro definition}} 4#define final 1 5#define __HAVE_X 0 6#define _HAVE_X 0 7#define X__Y 8 9#undef for 10#undef final 11#undef __HAVE_X 12#undef _HAVE_X 13#undef X__Y 14 15#undef __cplusplus 16#define __cplusplus 17 18// whitelisted definitions 19#define while while 20#define const 21#define static 22#define extern 23#define inline 24 25#undef while 26#undef const 27#undef static 28#undef extern 29#undef inline 30 31#define inline __inline 32#undef inline 33#define inline __inline__ 34#undef inline 35 36#define inline inline__ // expected-warning {{keyword is hidden by macro definition}} 37#undef inline 38#define extern __inline // expected-warning {{keyword is hidden by macro definition}} 39#undef extern 40#define extern __extern // expected-warning {{keyword is hidden by macro definition}} 41#undef extern 42#define extern __extern__ // expected-warning {{keyword is hidden by macro definition}} 43#undef extern 44 45#define inline _inline // expected-warning {{keyword is hidden by macro definition}} 46#undef inline 47#define volatile // expected-warning {{keyword is hidden by macro definition}} 48#undef volatile 49 50 51#pragma clang diagnostic warning "-Wreserved-id-macro" 52 53#define switch if // expected-warning {{keyword is hidden by macro definition}} 54#define final 1 55#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} 56#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}} 57#define X__Y // expected-warning {{macro name is a reserved identifier}} 58 59#undef __cplusplus // expected-warning {{macro name is a reserved identifier}} 60#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}} 61#undef X__Y // expected-warning {{macro name is a reserved identifier}} 62 63int x; 64