blob: 84b9262cb82ecf1a0ba7a031fdaec0f4d78b4c62 [file] [log] [blame]
Stephen Hines0e2c34f2015-03-23 12:09:02 -07001// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %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 __cplusplus
7#define _HAVE_X 0
8#define X__Y
9
10#undef for
11#undef final
12#undef __HAVE_X
13#undef __cplusplus
14#undef _HAVE_X
15#undef X__Y
16
17// whitelisted definitions
18#define while while
19#define const
20#define static
21#define extern
22#define inline
23
24#undef while
25#undef const
26#undef static
27#undef extern
28#undef inline
29
30#define inline __inline
31#undef inline
32#define inline __inline__
33#undef inline
34
35#define inline inline__ // expected-warning {{keyword is hidden by macro definition}}
36#undef inline
37#define extern __inline // expected-warning {{keyword is hidden by macro definition}}
38#undef extern
39#define extern __extern // expected-warning {{keyword is hidden by macro definition}}
40#undef extern
41#define extern __extern__ // expected-warning {{keyword is hidden by macro definition}}
42#undef extern
43
44#define inline _inline // expected-warning {{keyword is hidden by macro definition}}
45#undef inline
46#define volatile // expected-warning {{keyword is hidden by macro definition}}
47#undef volatile
48
49#pragma clang diagnostic warning "-Wreserved-id-macro"
50
51#define switch if // expected-warning {{keyword is hidden by macro definition}}
52#define final 1
53#define __clusplus // expected-warning {{macro name is a reserved identifier}}
54#define __HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
55#define _HAVE_X 0 // expected-warning {{macro name is a reserved identifier}}
56#define X__Y
57
58#undef switch
59#undef final
60#undef __cplusplus // expected-warning {{macro name is a reserved identifier}}
61#undef _HAVE_X // expected-warning {{macro name is a reserved identifier}}
62#undef X__Y
63
64int x;