fix spurious vstack-leak warnings on error
[tinycc/miki.git] / tcctok.h
blobf754af57f87f5c5dd7f7f13ced574385b37e5022
1 /* keywords */
2 DEF(TOK_INT, "int")
3 DEF(TOK_VOID, "void")
4 DEF(TOK_CHAR, "char")
5 DEF(TOK_IF, "if")
6 DEF(TOK_ELSE, "else")
7 DEF(TOK_WHILE, "while")
8 DEF(TOK_BREAK, "break")
9 DEF(TOK_RETURN, "return")
10 DEF(TOK_FOR, "for")
11 DEF(TOK_EXTERN, "extern")
12 DEF(TOK_STATIC, "static")
13 DEF(TOK_UNSIGNED, "unsigned")
14 DEF(TOK_GOTO, "goto")
15 DEF(TOK_DO, "do")
16 DEF(TOK_CONTINUE, "continue")
17 DEF(TOK_SWITCH, "switch")
18 DEF(TOK_CASE, "case")
20 DEF(TOK_CONST1, "const")
21 DEF(TOK_CONST2, "__const") /* gcc keyword */
22 DEF(TOK_CONST3, "__const__") /* gcc keyword */
23 DEF(TOK_VOLATILE1, "volatile")
24 DEF(TOK_VOLATILE2, "__volatile") /* gcc keyword */
25 DEF(TOK_VOLATILE3, "__volatile__") /* gcc keyword */
26 DEF(TOK_LONG, "long")
27 DEF(TOK_REGISTER, "register")
28 DEF(TOK_SIGNED1, "signed")
29 DEF(TOK_SIGNED2, "__signed") /* gcc keyword */
30 DEF(TOK_SIGNED3, "__signed__") /* gcc keyword */
31 DEF(TOK_AUTO, "auto")
32 DEF(TOK_INLINE1, "inline")
33 DEF(TOK_INLINE2, "__inline") /* gcc keyword */
34 DEF(TOK_INLINE3, "__inline__") /* gcc keyword */
35 DEF(TOK_RESTRICT1, "restrict")
36 DEF(TOK_RESTRICT2, "__restrict")
37 DEF(TOK_RESTRICT3, "__restrict__")
38 DEF(TOK_EXTENSION, "__extension__") /* gcc keyword */
40 DEF(TOK_FLOAT, "float")
41 DEF(TOK_DOUBLE, "double")
42 DEF(TOK_BOOL, "_Bool")
43 DEF(TOK_SHORT, "short")
44 DEF(TOK_STRUCT, "struct")
45 DEF(TOK_UNION, "union")
46 DEF(TOK_TYPEDEF, "typedef")
47 DEF(TOK_DEFAULT, "default")
48 DEF(TOK_ENUM, "enum")
49 DEF(TOK_SIZEOF, "sizeof")
50 DEF(TOK_ATTRIBUTE1, "__attribute")
51 DEF(TOK_ATTRIBUTE2, "__attribute__")
52 DEF(TOK_ALIGNOF1, "__alignof")
53 DEF(TOK_ALIGNOF2, "__alignof__")
54 DEF(TOK_TYPEOF1, "typeof")
55 DEF(TOK_TYPEOF2, "__typeof")
56 DEF(TOK_TYPEOF3, "__typeof__")
57 DEF(TOK_LABEL, "__label__")
58 DEF(TOK_ASM1, "asm")
59 DEF(TOK_ASM2, "__asm")
60 DEF(TOK_ASM3, "__asm__")
62 /*********************************************************************/
63 /* the following are not keywords. They are included to ease parsing */
64 /* preprocessor only */
65 DEF(TOK_DEFINE, "define")
66 DEF(TOK_INCLUDE, "include")
67 DEF(TOK_INCLUDE_NEXT, "include_next")
68 DEF(TOK_IFDEF, "ifdef")
69 DEF(TOK_IFNDEF, "ifndef")
70 DEF(TOK_ELIF, "elif")
71 DEF(TOK_ENDIF, "endif")
72 DEF(TOK_DEFINED, "defined")
73 DEF(TOK_UNDEF, "undef")
74 DEF(TOK_ERROR, "error")
75 DEF(TOK_WARNING, "warning")
76 DEF(TOK_LINE, "line")
77 DEF(TOK_PRAGMA, "pragma")
78 DEF(TOK___LINE__, "__LINE__")
79 DEF(TOK___FILE__, "__FILE__")
80 DEF(TOK___DATE__, "__DATE__")
81 DEF(TOK___TIME__, "__TIME__")
82 DEF(TOK___FUNCTION__, "__FUNCTION__")
83 DEF(TOK___VA_ARGS__, "__VA_ARGS__")
85 /* special identifiers */
86 DEF(TOK___FUNC__, "__func__")
88 /* special floating point values */
89 DEF(TOK___NAN__, "__nan__")
90 DEF(TOK___SNAN__, "__snan__")
91 DEF(TOK___INF__, "__inf__")
93 /* attribute identifiers */
94 /* XXX: handle all tokens generically since speed is not critical */
95 DEF(TOK_SECTION1, "section")
96 DEF(TOK_SECTION2, "__section__")
97 DEF(TOK_ALIGNED1, "aligned")
98 DEF(TOK_ALIGNED2, "__aligned__")
99 DEF(TOK_PACKED1, "packed")
100 DEF(TOK_PACKED2, "__packed__")
101 DEF(TOK_WEAK1, "weak")
102 DEF(TOK_WEAK2, "__weak__")
103 DEF(TOK_ALIAS1, "alias")
104 DEF(TOK_ALIAS2, "__alias__")
105 DEF(TOK_UNUSED1, "unused")
106 DEF(TOK_UNUSED2, "__unused__")
107 DEF(TOK_CDECL1, "cdecl")
108 DEF(TOK_CDECL2, "__cdecl")
109 DEF(TOK_CDECL3, "__cdecl__")
110 DEF(TOK_STDCALL1, "stdcall")
111 DEF(TOK_STDCALL2, "__stdcall")
112 DEF(TOK_STDCALL3, "__stdcall__")
113 DEF(TOK_FASTCALL1, "fastcall")
114 DEF(TOK_FASTCALL2, "__fastcall")
115 DEF(TOK_FASTCALL3, "__fastcall__")
116 DEF(TOK_MODE, "__mode__")
117 DEF(TOK_MODE_DI, "__DI__")
118 DEF(TOK_MODE_HI, "__HI__")
119 DEF(TOK_MODE_SI, "__SI__")
120 DEF(TOK_DLLEXPORT, "dllexport")
121 DEF(TOK_DLLIMPORT, "dllimport")
122 DEF(TOK_NORETURN1, "noreturn")
123 DEF(TOK_NORETURN2, "__noreturn__")
124 DEF(TOK_builtin_types_compatible_p, "__builtin_types_compatible_p")
125 DEF(TOK_builtin_constant_p, "__builtin_constant_p")
126 DEF(TOK_builtin_frame_address, "__builtin_frame_address")
127 #ifdef TCC_TARGET_X86_64
128 DEF(TOK_builtin_va_arg_types, "__builtin_va_arg_types")
129 #endif
130 DEF(TOK_REGPARM1, "regparm")
131 DEF(TOK_REGPARM2, "__regparm__")
133 /* pragma */
134 DEF(TOK_pack, "pack")
135 #if !defined(TCC_TARGET_I386) && !defined(TCC_TARGET_X86_64)
136 /* already defined for assembler */
137 DEF(TOK_ASM_push, "push")
138 DEF(TOK_ASM_pop, "pop")
139 #endif
141 /* builtin functions or variables */
142 #ifdef TCC_ARM_EABI
143 DEF(TOK_memcpy, "__aeabi_memcpy")
144 DEF(TOK_memcpy4, "__aeabi_memcpy4")
145 DEF(TOK_memcpy8, "__aeabi_memcpy8")
146 DEF(TOK_memset, "__aeabi_memset")
147 DEF(TOK___aeabi_ldivmod, "__aeabi_ldivmod")
148 DEF(TOK___aeabi_uldivmod, "__aeabi_uldivmod")
149 #else
150 DEF(TOK_memcpy, "memcpy")
151 DEF(TOK_memset, "memset")
152 DEF(TOK___divdi3, "__divdi3")
153 DEF(TOK___moddi3, "__moddi3")
154 DEF(TOK___udivdi3, "__udivdi3")
155 DEF(TOK___umoddi3, "__umoddi3")
156 #endif
157 #if defined(TCC_TARGET_ARM)
158 #ifdef TCC_ARM_EABI
159 DEF(TOK___aeabi_idivmod, "__aeabi_idivmod")
160 DEF(TOK___aeabi_uidivmod, "__aeabi_uidivmod")
161 DEF(TOK___divsi3, "__aeabi_idiv")
162 DEF(TOK___udivsi3, "__aeabi_uidiv")
163 DEF(TOK___floatdisf, "__aeabi_l2f")
164 DEF(TOK___floatdidf, "__aeabi_l2d")
165 DEF(TOK___fixsfdi, "__aeabi_f2lz")
166 DEF(TOK___fixdfdi, "__aeabi_d2lz")
167 #else
168 DEF(TOK___modsi3, "__modsi3")
169 DEF(TOK___umodsi3, "__umodsi3")
170 DEF(TOK___divsi3, "__divsi3")
171 DEF(TOK___udivsi3, "__udivsi3")
172 DEF(TOK___floatdisf, "__floatdisf")
173 DEF(TOK___floatdidf, "__floatdidf")
174 #ifndef TCC_ARM_VFP
175 DEF(TOK___floatdixf, "__floatdixf")
176 DEF(TOK___fixunssfsi, "__fixunssfsi")
177 DEF(TOK___fixunsdfsi, "__fixunsdfsi")
178 DEF(TOK___fixunsxfsi, "__fixunsxfsi")
179 DEF(TOK___fixxfdi, "__fixxfdi")
180 #endif
181 DEF(TOK___fixsfdi, "__fixsfdi")
182 DEF(TOK___fixdfdi, "__fixdfdi")
183 #endif
184 #elif defined(TCC_TARGET_C67)
185 DEF(TOK__divi, "_divi")
186 DEF(TOK__divu, "_divu")
187 DEF(TOK__divf, "_divf")
188 DEF(TOK__divd, "_divd")
189 DEF(TOK__remi, "_remi")
190 DEF(TOK__remu, "_remu")
191 #endif
192 #ifdef TCC_TARGET_I386
193 DEF(TOK___tcc_int_fpu_control, "__tcc_int_fpu_control")
194 DEF(TOK___tcc_fpu_control, "__tcc_fpu_control")
195 #endif
196 #ifdef TCC_ARM_EABI
197 DEF(TOK___ashrdi3, "__aeabi_lasr")
198 DEF(TOK___lshrdi3, "__aeabi_llsr")
199 DEF(TOK___ashldi3, "__aeabi_llsl")
200 DEF(TOK___floatundisf, "__aeabi_ul2f")
201 DEF(TOK___floatundidf, "__aeabi_ul2d")
202 DEF(TOK___fixunssfdi, "__aeabi_f2ulz")
203 DEF(TOK___fixunsdfdi, "__aeabi_d2ulz")
204 #else
205 DEF(TOK___ashrdi3, "__ashrdi3")
206 DEF(TOK___lshrdi3, "__lshrdi3")
207 DEF(TOK___ashldi3, "__ashldi3")
208 DEF(TOK___floatundisf, "__floatundisf")
209 DEF(TOK___floatundidf, "__floatundidf")
210 #ifndef TCC_ARM_VFP
211 DEF(TOK___floatundixf, "__floatundixf")
212 DEF(TOK___fixunsxfdi, "__fixunsxfdi")
213 #endif
214 DEF(TOK___fixunssfdi, "__fixunssfdi")
215 DEF(TOK___fixunsdfdi, "__fixunsdfdi")
216 #endif
217 #ifdef TCC_TARGET_PE
218 DEF(TOK___chkstk, "__chkstk")
219 #endif
221 /* bound checking symbols */
222 #ifdef CONFIG_TCC_BCHECK
223 DEF(TOK___bound_ptr_add, "__bound_ptr_add")
224 DEF(TOK___bound_ptr_indir1, "__bound_ptr_indir1")
225 DEF(TOK___bound_ptr_indir2, "__bound_ptr_indir2")
226 DEF(TOK___bound_ptr_indir4, "__bound_ptr_indir4")
227 DEF(TOK___bound_ptr_indir8, "__bound_ptr_indir8")
228 DEF(TOK___bound_ptr_indir12, "__bound_ptr_indir12")
229 DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16")
230 DEF(TOK___bound_local_new, "__bound_local_new")
231 DEF(TOK___bound_local_delete, "__bound_local_delete")
232 #ifdef TCC_TARGET_PE
233 DEF(TOK_malloc, "malloc")
234 DEF(TOK_free, "free")
235 DEF(TOK_realloc, "realloc")
236 DEF(TOK_memalign, "memalign")
237 DEF(TOK_calloc, "calloc")
238 #endif
239 DEF(TOK_memmove, "memmove")
240 DEF(TOK_strlen, "strlen")
241 DEF(TOK_strcpy, "strcpy")
242 #endif
243 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
244 DEF(TOK_alloca, "alloca")
245 #endif
247 /* Tiny Assembler */
248 DEF_ASM(byte)
249 DEF_ASM(word)
250 DEF_ASM(align)
251 DEF_ASM(skip)
252 DEF_ASM(space)
253 DEF_ASM(string)
254 DEF_ASM(asciz)
255 DEF_ASM(ascii)
256 DEF_ASM(file)
257 DEF_ASM(globl)
258 DEF_ASM(global)
259 DEF_ASM(ident)
260 DEF_ASM(size)
261 DEF_ASM(type)
262 DEF_ASM(text)
263 DEF_ASM(data)
264 DEF_ASM(bss)
265 DEF_ASM(previous)
266 DEF_ASM(fill)
267 DEF_ASM(org)
268 DEF_ASM(quad)
269 #if defined(TCC_TARGET_I386)
270 DEF_ASM(code16)
271 DEF_ASM(code32)
272 #elif defined(TCC_TARGET_X86_64)
273 DEF_ASM(code64)
274 #endif
276 #if defined TCC_TARGET_I386 || defined TCC_TARGET_X86_64
277 #include "i386-tok.h"
278 #endif