From fc574f14984d11f1ead50560d1bdc5ae0eaf6d8d Mon Sep 17 00:00:00 2001 From: Roy Date: Mon, 31 Dec 2012 08:59:50 +0800 Subject: win32: malloc.h: fix win32 tcc-tcc complication by correcting _STATIC_ASSERT, ideas from mingw-w64 changeset 4293 stdarg.h, stddef.h: _mingw.h needs them --- win32/include/stdarg.h | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 win32/include/stdarg.h (limited to 'win32/include/stdarg.h') diff --git a/win32/include/stdarg.h b/win32/include/stdarg.h new file mode 100644 index 0000000..666adf7 --- /dev/null +++ b/win32/include/stdarg.h @@ -0,0 +1,41 @@ +#ifndef _STDARG_H +#define _STDARG_H + +#ifdef __x86_64__ +#ifndef _WIN64 + +typedef void *va_list; + +va_list __va_start(void *fp); +void *__va_arg(va_list ap, int arg_type, int size); +va_list __va_copy(va_list src); +void __va_end(va_list ap); + +#define va_start(ap, last) ((ap) = __va_start(__builtin_frame_address(0))) +#define va_arg(ap, type) \ + (*(type *)(__va_arg(ap, __builtin_va_arg_types(type), sizeof(type)))) +#define va_copy(dest, src) ((dest) = __va_copy(src)) +#define va_end(ap) __va_end(ap) + +#else /* _WIN64 */ +typedef char *va_list; +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+7)&~7) +#define va_arg(ap,type) (ap += (sizeof(type)+7)&~7, *(type *)(ap - ((sizeof(type)+7)&~7))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) +#endif + +#else /* __i386__ */ +typedef char *va_list; +/* only correct for i386 */ +#define va_start(ap,last) ap = ((char *)&(last)) + ((sizeof(last)+3)&~3) +#define va_arg(ap,type) (ap += (sizeof(type)+3)&~3, *(type *)(ap - ((sizeof(type)+3)&~3))) +#define va_copy(dest, src) (dest) = (src) +#define va_end(ap) +#endif + +/* fix a buggy dependency on GCC in libio.h */ +typedef va_list __gnuc_va_list; +#define _VA_LIST_DEFINED + +#endif /* _STDARG_H */ -- cgit v1.3.1