2015-08-01 10:55:59 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -pedantic -std=c++98 %s
|
2014-12-17 05:16:10 +08:00
|
|
|
|
2014-12-12 14:37:55 +08:00
|
|
|
#define for 0 // expected-warning {{keyword is hidden by macro definition}}
|
2014-12-18 19:14:21 +08:00
|
|
|
#define final 1
|
2014-12-12 14:37:55 +08:00
|
|
|
#define __HAVE_X 0
|
|
|
|
#define _HAVE_X 0
|
|
|
|
#define X__Y
|
|
|
|
|
2014-12-18 19:14:21 +08:00
|
|
|
#undef for
|
|
|
|
#undef final
|
|
|
|
#undef __HAVE_X
|
2014-12-12 14:37:55 +08:00
|
|
|
#undef _HAVE_X
|
|
|
|
#undef X__Y
|
|
|
|
|
2014-12-18 19:14:21 +08:00
|
|
|
#undef __cplusplus
|
|
|
|
#define __cplusplus
|
|
|
|
|
|
|
|
// whitelisted definitions
|
|
|
|
#define while while
|
|
|
|
#define const
|
|
|
|
#define static
|
|
|
|
#define extern
|
|
|
|
#define inline
|
|
|
|
|
|
|
|
#undef while
|
|
|
|
#undef const
|
|
|
|
#undef static
|
|
|
|
#undef extern
|
|
|
|
#undef inline
|
|
|
|
|
|
|
|
#define inline __inline
|
|
|
|
#undef inline
|
|
|
|
#define inline __inline__
|
|
|
|
#undef inline
|
|
|
|
|
|
|
|
#define inline inline__ // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef inline
|
|
|
|
#define extern __inline // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef extern
|
|
|
|
#define extern __extern // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef extern
|
|
|
|
#define extern __extern__ // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef extern
|
|
|
|
|
|
|
|
#define inline _inline // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef inline
|
|
|
|
#define volatile // expected-warning {{keyword is hidden by macro definition}}
|
|
|
|
#undef volatile
|
|
|
|
|
2020-12-09 16:26:27 +08:00
|
|
|
#pragma clang diagnostic warning "-Wreserved-macro-identifier"
|
2014-12-18 19:14:21 +08:00
|
|
|
|
2014-12-12 14:37:55 +08:00
|
|
|
#define switch if // expected-warning {{keyword is hidden by macro definition}}
|
2014-12-18 19:14:21 +08:00
|
|
|
#define final 1
|
|
|
|
#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
|
|
|
|
#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
|
|
|
|
#define X__Y // expected-warning {{macro name is a reserved identifier}}
|
2014-12-12 14:37:55 +08:00
|
|
|
|
2014-12-18 19:14:21 +08:00
|
|
|
#undef __cplusplus // expected-warning {{macro name is a reserved identifier}}
|
|
|
|
#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}}
|
|
|
|
#undef X__Y // expected-warning {{macro name is a reserved identifier}}
|
2014-12-12 14:37:55 +08:00
|
|
|
|
|
|
|
int x;
|