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