diff options
| author | Shinichiro Hamaji <shinichiro.hamaji _at_ gmail.com> | 2009-04-01 03:45:18 +0900 |
|---|---|---|
| committer | grischka <grischka> | 2009-04-18 15:07:09 +0200 |
| commit | ebb874e2164308b1b9a53a2b1f6d1b9f65894059 (patch) | |
| tree | 8f20f558fe52bac208014ab4d8609ec6ad58bcff /stdarg.h | |
| parent | 6512d9e2eac343c8419f61866ec7b866e19bf2c4 (diff) | |
| download | tinycc-ebb874e2164308b1b9a53a2b1f6d1b9f65894059.tar.gz tinycc-ebb874e2164308b1b9a53a2b1f6d1b9f65894059.tar.bz2 | |
Remove multiple definition error caused by combination of x86-64 and va_list.
We need malloc and free to implement va_start and va_end.
Since malloc and free may be replaced by #define, we add __builtin_malloc and __builtin_free.
Diffstat (limited to 'stdarg.h')
| -rw-r--r-- | stdarg.h | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -20,14 +20,10 @@ struct __va_list_struct { typedef struct __va_list_struct *va_list; -/* avoid #define malloc tcc_malloc. - XXX: add __malloc or something into libtcc? */ -inline void *__va_list_malloc(size_t size) { return malloc(size); } -inline void __va_list_free(void *ptr) { free(ptr); } - +/* we use __builtin_(malloc|free) to avoid #define malloc tcc_malloc */ /* XXX: this lacks the support of aggregated types. */ #define va_start(ap, last) \ - (ap = (va_list)__va_list_malloc(sizeof(struct __va_list_struct)), \ + (ap = (va_list)__builtin_malloc(sizeof(struct __va_list_struct)), \ *ap = *(struct __va_list_struct*)( \ (char*)__builtin_frame_address(0) - 16), \ ap->overflow_arg_area = ((char *)__builtin_frame_address(0) + \ @@ -53,7 +49,7 @@ inline void __va_list_free(void *ptr) { free(ptr); } #define va_copy(dest, src) \ ((dest) = (va_list)malloc(sizeof(struct __va_list_struct)), \ *(dest) = *(src)) -#define va_end(ap) __va_list_free(ap) +#define va_end(ap) __builtin_free(ap) #else |
