blob: 84b9262cb82ecf1a0ba7a031fdaec0f4d78b4c62 [file] [log] [blame]
Serge Pavlov07c0f042014-12-18 11:14:21 +00001// RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
Nico Weber92c14bb2014-12-16 21:16:10 +00002
Serge Pavlov59da7b82014-12-12 06:37:55 +00003#define for 0 // expected-warning {{keyword is hidden by macro definition}}
4#define final 1
5#define __HAVE_X 0
Serge Pavlov07c0f042014-12-18 11:14:21 +00006#define __cplusplus
Serge Pavlov59da7b82014-12-12 06:37:55 +00007#define _HAVE_X 0
8#define X__Y
9
Serge Pavlov07c0f042014-12-18 11:14:21 +000010#undef for
11#undef final
12#undef __HAVE_X
Serge Pavlov59da7b82014-12-12 06:37:55 +000013#undef __cplusplus
14#undef _HAVE_X
15#undef X__Y
16
Serge Pavlov07c0f042014-12-18 11:14:21 +000017// 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
Serge Pavlov59da7b82014-12-12 06:37:55 +000051#define switch if // expected-warning {{keyword is hidden by macro definition}}
52#define final 1
Serge Pavlov07c0f042014-12-18 11:14:21 +000053#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}}
Serge Pavlov59da7b82014-12-12 06:37:55 +000056#define X__Y
57
Serge Pavlov07c0f042014-12-18 11:14:21 +000058#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}}
Serge Pavlov59da7b82014-12-12 06:37:55 +000062#undef X__Y
63
64int x;