• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // 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 
64 int x;
65