From c089fab91044a4030598edebb8279311d61b65c1 Mon Sep 17 00:00:00 2001 From: midipix Date: Mon, 19 Dec 2016 11:56:19 -0500 Subject: move vararg definitions to compiler-specific headers. --- include/psxtypes/arch/nt32/ntalltypes.h | 7 ------- include/psxtypes/arch/nt64/ntalltypes.h | 7 ------- include/psxtypes/compiler/__nt_compiler_gcc.h | 13 ++++++++----- include/psxtypes/compiler/__nt_compiler_msvc.h | 21 ++++++++++++++++----- include/psxtypes/compiler/__psx_compiler_gcc.h | 13 ++++++++----- 5 files changed, 32 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/include/psxtypes/arch/nt32/ntalltypes.h b/include/psxtypes/arch/nt32/ntalltypes.h index af3e899..5e61552 100644 --- a/include/psxtypes/arch/nt32/ntalltypes.h +++ b/include/psxtypes/arch/nt32/ntalltypes.h @@ -176,10 +176,3 @@ typedef float float_t; typedef double double_t; #define __DEFINED_double_t #endif - -typedef __CUSTOM_OR_BUILTIN_va_list__ va_list; - -#define va_start(v,l) __builtin_va_start(v,l) -#define va_end(v) __builtin_va_end(v) -#define va_arg(v,l) __builtin_va_arg(v,l) -#define va_copy(d,s) __builtin_va_copy(d,s) diff --git a/include/psxtypes/arch/nt64/ntalltypes.h b/include/psxtypes/arch/nt64/ntalltypes.h index 330b580..d6640f8 100644 --- a/include/psxtypes/arch/nt64/ntalltypes.h +++ b/include/psxtypes/arch/nt64/ntalltypes.h @@ -176,10 +176,3 @@ typedef float float_t; typedef double double_t; #define __DEFINED_double_t #endif - -typedef __CUSTOM_OR_BUILTIN_va_list__ va_list; - -#define va_start(v,l) __builtin_va_start(v,l) -#define va_end(v) __builtin_va_end(v) -#define va_arg(v,l) __builtin_va_arg(v,l) -#define va_copy(d,s) __builtin_va_copy(d,s) diff --git a/include/psxtypes/compiler/__nt_compiler_gcc.h b/include/psxtypes/compiler/__nt_compiler_gcc.h index 5eb49a0..df81c64 100644 --- a/include/psxtypes/compiler/__nt_compiler_gcc.h +++ b/include/psxtypes/compiler/__nt_compiler_gcc.h @@ -38,11 +38,6 @@ #define __X86_64_MODEL __amd64 #endif - -/* va_list */ -#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list - - /* compiler keywords */ #define __in #define __out @@ -132,4 +127,12 @@ #define __stdcall #endif +/* vararg */ +typedef __builtin_va_list va_list; + +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#define va_copy(d,s) __builtin_va_copy(d,s) + #endif /* _PSXTYPES_NT_COMPILER_GCC_H_ */ diff --git a/include/psxtypes/compiler/__nt_compiler_msvc.h b/include/psxtypes/compiler/__nt_compiler_msvc.h index b441221..c865706 100644 --- a/include/psxtypes/compiler/__nt_compiler_msvc.h +++ b/include/psxtypes/compiler/__nt_compiler_msvc.h @@ -53,11 +53,6 @@ #define __X86_64_MODEL __amd64 #endif - -/* va_list */ -#define __CUSTOM_OR_BUILTIN_va_list__ char * - - /* compiler keywords */ #define __in #define __out @@ -127,4 +122,20 @@ #define NTAPI __stdcall #define WINAPI __stdcall +/* vararg */ +typedef char * va_list; + +#if defined(__NT32) +void __cdecl __va_start(char ** ,...); +#define __va_size(l) (((sizeof(void *)-1) + sizeof(l)) & ~(sizeof(void *)-1)) +#define va_start(v,l) ((void)(v = (char *)((&(l)) + __va_size(l)))) +#define va_end(v) ((void)(v = 0)) +#endif + +#if defined(__NT64) +void __cdecl __va_start(char ** ,...); +#define va_start(v,l) ((void)(__va_start(&v, l))) +#define va_end(v) ((void)(v = 0)) +#endif + #endif /* _PSXTYPES_NT_COMPILER_MSVC_H_ */ diff --git a/include/psxtypes/compiler/__psx_compiler_gcc.h b/include/psxtypes/compiler/__psx_compiler_gcc.h index 5995bf1..ee205f3 100644 --- a/include/psxtypes/compiler/__psx_compiler_gcc.h +++ b/include/psxtypes/compiler/__psx_compiler_gcc.h @@ -30,11 +30,6 @@ #define __X86_64_MODEL __amd64 #endif - -/* va_list */ -#define __CUSTOM_OR_BUILTIN_va_list__ __builtin_va_list - - /* compiler keywords */ #define __in #define __out @@ -96,4 +91,12 @@ #define NTAPI #define WINAPI +/* vararg */ +typedef __builtin_va_list va_list; + +#define va_start(v,l) __builtin_va_start(v,l) +#define va_end(v) __builtin_va_end(v) +#define va_arg(v,l) __builtin_va_arg(v,l) +#define va_copy(d,s) __builtin_va_copy(d,s) + #endif /* _PSXTYPES_COMPILER_GCC_H_ */ -- cgit v1.2.3