From 41349948f8db22b09a22628dad15eb40a45d2eff Mon Sep 17 00:00:00 2001 From: grischka Date: Sun, 10 Jul 2016 20:44:49 +0200 Subject: win64: fix va_arg fixes 5c35ba66c5ade4713bbd9c005e66889f6d7db293 Implementation was consistent within tcc but incompatible with the ABI (for example library functions vprintf etc) Also: - tccpp.c/get_tok_str() : avoid "unknown format "%llu" warning - x86_64_gen.c/gen_vla_alloc() : fix vstack leak --- include/stdarg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/stdarg.h b/include/stdarg.h index 06d592b..9fff0c0 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -30,7 +30,8 @@ void *__va_arg(__va_list_struct *ap, int arg_type, int size, int align); #else /* _WIN64 */ typedef char *va_list; #define va_start(ap,last) __builtin_va_start(ap,last) -#define va_arg(ap,type) (ap += 8, sizeof(type)<=8 ? *(type*)ap : **(type**)ap) +#define va_arg(ap, t) ((sizeof(t) > 8 || (sizeof(t) & (sizeof(t) - 1))) \ + ? **(t **)((ap += 8) - 8) : *(t *)((ap += 8) - 8)) #define va_copy(dest, src) ((dest) = (src)) #define va_end(ap) #endif -- cgit v1.3.1