diff --git a/tcctok.h b/tcctok.h index a556c83..6dc6cf4 100644 --- a/tcctok.h +++ b/tcctok.h @@ -1,66 +1,124 @@ -DEF(TOK___LINE__, "__LINE__") -DEF(TOK___FILE__, "__FILE__") -DEF(TOK___DATE__, "__DATE__") -DEF(TOK___TIME__, "__TIME__") -DEF(TOK___FUNCTION__, "__FUNCTION__") -DEF(TOK___VA_ARGS__, "__VA_ARGS__") +/* keywords */ + DEF(TOK_INT, "int") + DEF(TOK_VOID, "void") + DEF(TOK_CHAR, "char") + DEF(TOK_IF, "if") + DEF(TOK_ELSE, "else") + DEF(TOK_WHILE, "while") + DEF(TOK_BREAK, "break") + DEF(TOK_RETURN, "return") + DEF(TOK_FOR, "for") + DEF(TOK_EXTERN, "extern") + DEF(TOK_STATIC, "static") + DEF(TOK_UNSIGNED, "unsigned") + DEF(TOK_GOTO, "goto") + DEF(TOK_DO, "do") + DEF(TOK_CONTINUE, "continue") + DEF(TOK_SWITCH, "switch") + DEF(TOK_CASE, "case") + /* ignored types Must have contiguous values */ + DEF(TOK_CONST, "const") + DEF(TOK_VOLATILE, "volatile") + DEF(TOK_LONG, "long") + DEF(TOK_REGISTER, "register") + DEF(TOK_SIGNED, "signed") + DEF(TOK___SIGNED__, "__signed__") /* gcc keyword */ + DEF(TOK_AUTO, "auto") + DEF(TOK_INLINE, "inline") + DEF(TOK___INLINE__, "__inline__") /* gcc keyword */ + DEF(TOK_RESTRICT, "restrict") + + DEF(TOK_FLOAT, "float") + DEF(TOK_DOUBLE, "double") + DEF(TOK_BOOL, "_Bool") + DEF(TOK_SHORT, "short") + DEF(TOK_STRUCT, "struct") + DEF(TOK_UNION, "union") + DEF(TOK_TYPEDEF, "typedef") + DEF(TOK_DEFAULT, "default") + DEF(TOK_ENUM, "enum") + DEF(TOK_SIZEOF, "sizeof") + DEF(TOK___ATTRIBUTE__, "__attribute__") + DEF(TOK_ALIGNOF, "__alignof__") + DEF(TOK_TYPEOF, "typeof") + +/*********************************************************************/ +/* the following are not keywords. They are included to ease parsing */ +/* preprocessor only */ + DEF(TOK_DEFINE, "define") + DEF(TOK_INCLUDE, "include") + DEF(TOK_IFDEF, "ifdef") + DEF(TOK_IFNDEF, "ifndef") + DEF(TOK_ELIF, "elif") + DEF(TOK_ENDIF, "endif") + DEF(TOK_DEFINED, "defined") + DEF(TOK_UNDEF, "undef") + DEF(TOK_ERROR, "error") + DEF(TOK_LINE, "line") + DEF(TOK___LINE__, "__LINE__") + DEF(TOK___FILE__, "__FILE__") + DEF(TOK___DATE__, "__DATE__") + DEF(TOK___TIME__, "__TIME__") + DEF(TOK___FUNCTION__, "__FUNCTION__") + DEF(TOK___VA_ARGS__, "__VA_ARGS__") + /* special identifiers */ -DEF(TOK___FUNC__, "__func__") - + DEF(TOK___FUNC__, "__func__") + /* attribute identifiers */ -DEF(TOK_SECTION, "section") -DEF(TOK___SECTION__, "__section__") -DEF(TOK_ALIGNED, "aligned") -DEF(TOK___ALIGNED__, "__aligned__") -DEF(TOK_UNUSED, "unused") -DEF(TOK___UNUSED__, "__unused__") -DEF(TOK_CDECL, "cdecl") -DEF(TOK___CDECL, "__cdecl") -DEF(TOK___CDECL__, "__cdecl__") -DEF(TOK_STDCALL, "stdcall") -DEF(TOK___STDCALL, "__stdcall") -DEF(TOK___STDCALL__, "__stdcall__") -DEF(TOK_NORETURN, "noreturn") -DEF(TOK___NORETURN__, "__noreturn__") + DEF(TOK_SECTION, "section") + DEF(TOK___SECTION__, "__section__") + DEF(TOK_ALIGNED, "aligned") + DEF(TOK___ALIGNED__, "__aligned__") + DEF(TOK_UNUSED, "unused") + DEF(TOK___UNUSED__, "__unused__") + DEF(TOK_CDECL, "cdecl") + DEF(TOK___CDECL, "__cdecl") + DEF(TOK___CDECL__, "__cdecl__") + DEF(TOK_STDCALL, "stdcall") + DEF(TOK___STDCALL, "__stdcall") + DEF(TOK___STDCALL__, "__stdcall__") + DEF(TOK_NORETURN, "noreturn") + DEF(TOK___NORETURN__, "__noreturn__") /* builtin functions or variables */ -DEF(TOK_memcpy, "memcpy") -DEF(TOK_memset, "memset") -DEF(TOK_alloca, "alloca") -DEF(TOK___divdi3, "__divdi3") -DEF(TOK___moddi3, "__moddi3") -DEF(TOK___udivdi3, "__udivdi3") -DEF(TOK___umoddi3, "__umoddi3") -DEF(TOK___sardi3, "__sardi3") -DEF(TOK___shrdi3, "__shrdi3") -DEF(TOK___shldi3, "__shldi3") -DEF(TOK___tcc_int_fpu_control, "__tcc_int_fpu_control") -DEF(TOK___tcc_fpu_control, "__tcc_fpu_control") -DEF(TOK___ulltof, "__ulltof") -DEF(TOK___ulltod, "__ulltod") -DEF(TOK___ulltold, "__ulltold") -DEF(TOK___fixunssfdi, "__fixunssfdi") -DEF(TOK___fixunsdfdi, "__fixunsdfdi") -DEF(TOK___fixunsxfdi, "__fixunsxfdi") + DEF(TOK_memcpy, "memcpy") + DEF(TOK_memset, "memset") + DEF(TOK_alloca, "alloca") + DEF(TOK___divdi3, "__divdi3") + DEF(TOK___moddi3, "__moddi3") + DEF(TOK___udivdi3, "__udivdi3") + DEF(TOK___umoddi3, "__umoddi3") + DEF(TOK___sardi3, "__sardi3") + DEF(TOK___shrdi3, "__shrdi3") + DEF(TOK___shldi3, "__shldi3") + DEF(TOK___tcc_int_fpu_control, "__tcc_int_fpu_control") + DEF(TOK___tcc_fpu_control, "__tcc_fpu_control") + DEF(TOK___ulltof, "__ulltof") + DEF(TOK___ulltod, "__ulltod") + DEF(TOK___ulltold, "__ulltold") + DEF(TOK___fixunssfdi, "__fixunssfdi") + DEF(TOK___fixunsdfdi, "__fixunsdfdi") + DEF(TOK___fixunsxfdi, "__fixunsxfdi") /* bound checking symbols */ #ifdef CONFIG_TCC_BCHECK -DEF(TOK___bound_ptr_add, "__bound_ptr_add") -DEF(TOK___bound_ptr_indir1, "__bound_ptr_indir1") -DEF(TOK___bound_ptr_indir2, "__bound_ptr_indir2") -DEF(TOK___bound_ptr_indir4, "__bound_ptr_indir4") -DEF(TOK___bound_ptr_indir8, "__bound_ptr_indir8") -DEF(TOK___bound_ptr_indir12, "__bound_ptr_indir12") -DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16") -DEF(TOK___bound_local_new, "__bound_local_new") -DEF(TOK___bound_local_delete, "__bound_local_delete") -DEF(TOK_malloc, "malloc") -DEF(TOK_free, "free") -DEF(TOK_realloc, "realloc") -DEF(TOK_memalign, "memalign") -DEF(TOK_calloc, "calloc") -DEF(TOK_memmove, "memmove") -DEF(TOK_strlen, "strlen") -DEF(TOK_strcpy, "strcpy") + DEF(TOK___bound_ptr_add, "__bound_ptr_add") + DEF(TOK___bound_ptr_indir1, "__bound_ptr_indir1") + DEF(TOK___bound_ptr_indir2, "__bound_ptr_indir2") + DEF(TOK___bound_ptr_indir4, "__bound_ptr_indir4") + DEF(TOK___bound_ptr_indir8, "__bound_ptr_indir8") + DEF(TOK___bound_ptr_indir12, "__bound_ptr_indir12") + DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16") + DEF(TOK___bound_local_new, "__bound_local_new") + DEF(TOK___bound_local_delete, "__bound_local_delete") + DEF(TOK_malloc, "malloc") + DEF(TOK_free, "free") + DEF(TOK_realloc, "realloc") + DEF(TOK_memalign, "memalign") + DEF(TOK_calloc, "calloc") + DEF(TOK_memmove, "memmove") + DEF(TOK_strlen, "strlen") + DEF(TOK_strcpy, "strcpy") #endif