TOK_builtin_malloc: alternative solution

This commit is contained in:
grischka 2009-04-16 19:32:59 +02:00
parent 742cf05875
commit 9a8b2912ed
2 changed files with 8 additions and 14 deletions

14
tcc.c
View File

@ -7801,21 +7801,11 @@ static void unary(void)
break; break;
#ifdef TCC_TARGET_X86_64 #ifdef TCC_TARGET_X86_64
case TOK_builtin_malloc: case TOK_builtin_malloc:
{ tok = TOK_malloc;
char *p = file->buf_ptr;
file->buf_ptr = "malloc";
next_nomacro1();
file->buf_ptr = p;
goto tok_identifier; goto tok_identifier;
}
case TOK_builtin_free: case TOK_builtin_free:
{ tok = TOK_free;
char *p = file->buf_ptr;
file->buf_ptr = "free";
next_nomacro1();
file->buf_ptr = p;
goto tok_identifier; goto tok_identifier;
}
#endif #endif
case TOK_INC: case TOK_INC:
case TOK_DEC: case TOK_DEC:

View File

@ -113,6 +113,8 @@
#ifdef TCC_TARGET_X86_64 #ifdef TCC_TARGET_X86_64
DEF(TOK_builtin_malloc, "__builtin_malloc") DEF(TOK_builtin_malloc, "__builtin_malloc")
DEF(TOK_builtin_free, "__builtin_free") DEF(TOK_builtin_free, "__builtin_free")
DEF(TOK_malloc, "malloc")
DEF(TOK_free, "free")
#endif #endif
DEF(TOK_REGPARM1, "regparm") DEF(TOK_REGPARM1, "regparm")
DEF(TOK_REGPARM2, "__regparm__") DEF(TOK_REGPARM2, "__regparm__")
@ -216,11 +218,13 @@
DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16") DEF(TOK___bound_ptr_indir16, "__bound_ptr_indir16")
DEF(TOK___bound_local_new, "__bound_local_new") DEF(TOK___bound_local_new, "__bound_local_new")
DEF(TOK___bound_local_delete, "__bound_local_delete") DEF(TOK___bound_local_delete, "__bound_local_delete")
#if 0
DEF(TOK_malloc, "malloc") DEF(TOK_malloc, "malloc")
DEF(TOK_free, "free") DEF(TOK_free, "free")
DEF(TOK_realloc, "realloc") DEF(TOK_realloc, "realloc")
DEF(TOK_memalign, "memalign") DEF(TOK_memalign, "memalign")
DEF(TOK_calloc, "calloc") DEF(TOK_calloc, "calloc")
#endif
DEF(TOK_memmove, "memmove") DEF(TOK_memmove, "memmove")
DEF(TOK_strlen, "strlen") DEF(TOK_strlen, "strlen")
DEF(TOK_strcpy, "strcpy") DEF(TOK_strcpy, "strcpy")