main: rework preprocessor invocation
[cparser] / tokens.inc
1 /* These must go first. Some set explicit values. */
2 #define ALTERNATE(name, val)          T(_CXX, T_##name, #name,  val)
3 #define PUNCTUATOR(name, string, val) T(_ALL, T_##name, string, val)
4 #include "tokens_punctuator.inc"
5 #undef PUNCTUATOR
6 #undef ALTERNATE
7
8 #define S(name, description) T(_ALL, T_##name, description,)
9 S(EOF,                "end of input")
10 S(IDENTIFIER,         "identifier")
11 S(NUMBER,             "number constant")
12 S(CHARACTER_CONSTANT, "character constant")
13 S(STRING_LITERAL,     "string literal")
14 S(MACRO_PARAMETER,    "macro parameter")
15 S(UNKNOWN_CHAR,       "unknown character")
16 #undef S
17
18 #define S(mode,x)   T(mode,T_##x,#x,)
19 S(_ALL, auto)
20 S(_ALL, break)
21 S(_ALL, case)
22 S(_ALL, char)
23 S(_ALL, continue)
24 S(_ALL, default)
25 S(_ALL, do)
26 S(_ALL, double)
27 S(_ALL, else)
28 S(_ALL, enum)
29 S(_ALL, extern)
30 S(_ALL, float)
31 S(_ALL, for)
32 S(_ALL, goto)
33 S(_ALL, if)
34 S(_ALL, int)
35 S(_ALL, long)
36 S(_ALL, register)
37 S(_ALL, return)
38 S(_ALL, short)
39 S(_ALL, sizeof)
40 S(_ALL, static)
41 S(_ALL, struct)
42 S(_ALL, switch)
43 S(_ALL, typedef)
44 S(_ALL, union)
45 S(_ALL, unsigned)
46 S(_ALL, void)
47 S(_ALL, while)
48
49 /* C++ keywords */
50 S(_CXX, bool)
51 S(_CXX, catch)
52 S(_CXX, class)
53 S(_CXX, const_cast)
54 S(_CXX, delete)
55 S(_CXX, dynamic_cast)
56 S(_CXX, explicit)
57 S(_CXX, export)
58 S(_CXX, false)
59 S(_CXX, friend)
60 S(_CXX, mutable)
61 S(_CXX, namespace)
62 S(_CXX, new)
63 S(_CXX, operator)
64 S(_CXX, private)
65 S(_CXX, protected)
66 S(_CXX, public)
67 S(_CXX, reinterpret_cast)
68 S(_CXX, static_cast)
69 S(_CXX, template)
70 S(_CXX, this)
71 S(_CXX, throw)
72 S(_CXX, true)
73 S(_CXX, try)
74 S(_CXX, typeid)
75 S(_CXX, typename)
76 S(_CXX, using)
77 S(_CXX, virtual)
78 S(_CXX, wchar_t)
79
80 S(_C99|_GNUC, _Bool)
81
82 S(_C11, _Alignas)
83 S(_C11, _Atomic)
84 S(_C11, _Generic)
85 S(_C11, _Noreturn)
86 S(_C11, _Static_assert)
87
88 S(_ALL, __extension__)
89 S(_ALL, __builtin_classify_type)
90 S(_ALL, __builtin_va_list)
91 S(_ALL, __builtin_va_arg)
92 S(_ALL, __builtin_va_copy)
93 S(_ALL, __builtin_offsetof)
94 S(_ALL, __builtin_constant_p)
95 S(_ALL, __builtin_types_compatible_p)
96 S(_ALL, __builtin_isgreater)
97 S(_ALL, __builtin_isgreaterequal)
98 S(_ALL, __builtin_isless)
99 S(_ALL, __builtin_islessequal)
100 S(_ALL, __builtin_islessgreater)
101 S(_ALL, __builtin_isunordered)
102 S(_ALL, __PRETTY_FUNCTION__)
103 S(_ALL, __label__)
104 S(_MS, __FUNCSIG__)
105 S(_MS, __FUNCDNAME__)
106 #undef S
107
108 #define S(mode, x, val) T(mode, T_##x, #x, val)
109 S(_C99,            __func__,)
110 S(_ALL,            __FUNCTION__,           = T___func__)
111 S(_C11,             _Thread_local,         )
112 S(_ALL,            __thread,               = T__Thread_local)
113 S(_ALL,              signed,               )
114 S(_ALL,            __signed,               = T_signed)
115 S(_ALL,            __signed__,             = T_signed)
116 S(_C99|_GNUC,       _Complex,              )
117 S(_ALL,            __complex__,            = T__Complex)
118 S(_ALL,            __complex,              = T__Complex)
119 S(_C99|_GNUC,       _Imaginary,            )
120 S(_ALL,            __real__,               )
121 S(_ALL,            __real,                 = T___real__)
122 S(_ALL,            __imag__,               )
123 S(_ALL,            __imag,                 = T___imag__)
124 S(_C11,             _Alignof,              )
125 S(_ALL,            __alignof__,            = T__Alignof)
126 S(_ALL,            __alignof,              = T__Alignof)
127 S(_MS,              _alignof,              = T__Alignof)
128 S(_ALL,              const,                )
129 S(_ALL,            __const,                = T_const)
130 S(_ALL,            __const__,              = T_const)
131 S(_C99,              restrict,             )
132 S(_ALL,            __restrict__,           = T_restrict)
133 S(_ALL,            __restrict,             = T_restrict)
134 S(_MS,              _restrict,             = T_restrict)
135 S(_ALL,              asm,                  )
136 S(_ALL,            __asm__,                = T_asm)
137 S(_MS,              _asm,                  = T_asm)
138 S(_ALL,            __asm,                  = T_asm)
139 S(_ALL,              volatile,             )
140 S(_ALL,            __volatile,             = T_volatile)
141 S(_ALL,            __volatile__,           = T_volatile)
142 S(_C99|_CXX|_GNUC,   inline,               )
143 S(_ALL,            __inline,               = T_inline)
144 S(_ALL,            __inline__,             = T_inline)
145 S(_GNUC,             typeof,               )
146 S(_ALL,            __typeof,               = T_typeof)
147 S(_ALL,            __typeof__,             = T_typeof)
148 S(_ALL,            __attribute__,          )
149
150 S(_ALL,            __builtin_va_start,     )
151 S(_ALL,            __builtin_stdarg_start, = T___builtin_va_start)
152
153 S(_MS,              _near,                 )
154 S(_MS,             __near,                 = T__near)
155 S(_MS,              _far,                  )
156 S(_MS,             __far,                  = T__far)
157 S(_MS,               cdecl,                )
158 S(_MS,              _cdecl,                = T_cdecl)
159 S(_MS,             __cdecl,                = T_cdecl)
160 S(_MS,              _stdcall,              )
161 S(_MS,             __stdcall,              = T__stdcall)
162 S(_MS,              _fastcall,             )
163 S(_MS,             __fastcall,             = T__fastcall)
164 S(_MS,             __thiscall,             )
165 S(_MS,              _forceinline,          )
166 S(_MS,             __forceinline,          = T__forceinline)
167 S(_MS,             __unaligned,            )
168 S(_MS,              _assume,               )
169 S(_MS,             __assume,               = T__assume)
170 S(_MS,              _try,                  )
171 S(_MS,             __try,                  = T__try)
172 S(_MS,              _finally,              )
173 S(_MS,             __finally,              = T__finally)
174 S(_MS,              _leave,                )
175 S(_MS,             __leave,                = T__leave)
176 S(_MS,              _except,               )
177 S(_MS,             __except,               = T__except)
178 S(_MS,              _declspec,             )
179 S(_MS,             __declspec,             = T__declspec)
180 S(_MS,              _based,                )
181 S(_MS,             __based,                = T__based)
182 S(_MS,             __noop,                 )
183
184 S(_MS,             __ptr32,                )
185 S(_MS,             __ptr64,                )
186 S(_MS,             __sptr,                 )
187 S(_MS,             __uptr,                 )
188 S(_MS,              _w64,                  )
189 S(_MS,             __w64,                  = T__w64)
190
191 S(_MS,              _int8,                 )
192 S(_MS,             __int8,                 = T__int8)
193 S(_MS,              _int16,                )
194 S(_MS,             __int16,                = T__int16)
195 S(_MS,              _int32,                )
196 S(_MS,             __int32,                = T__int32)
197 S(_MS,              _int64,                )
198 S(_MS,             __int64,                = T__int64)
199 S(_MS,              _int128,               )
200 S(_MS,             __int128,               = T__int128)
201 #undef S
202
203 /* Redefine required macros for MinGW headers */
204 #if defined(__MINGW32__) || defined(__CYGWIN__)
205 #define __stdcall __attribute__((__stdcall__))
206 #define __fastcall __attribute__((__fastcall__))
207 #define __cdecl __attribute__((__cdecl__))
208 #endif