From 8256f7ec08fe026d302c529a2ff8908609b454bc Mon Sep 17 00:00:00 2001 From: imp Date: Mon, 12 Feb 2018 14:48:20 +0000 Subject: [PATCH] Move __va_list and related defines to sys/sys/_types.h __va_list and related defines are identical in all the ARCH/include/_types.h files. Move them to sys/sys/_types.h Sponsored by: Netflix --- sys/arm/include/_types.h | 14 -------------- sys/arm64/include/_types.h | 14 -------------- sys/mips/include/_types.h | 14 -------------- sys/powerpc/include/_types.h | 20 -------------------- sys/riscv/include/_types.h | 14 -------------- sys/sparc64/include/_types.h | 14 -------------- sys/sys/_types.h | 15 +++++++++++++++ sys/x86/include/_types.h | 22 ---------------------- 8 files changed, 15 insertions(+), 112 deletions(-) diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h index de299e9bb680..0871adc778be 100644 --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -109,18 +109,4 @@ typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ #define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h index f1d4af4ab1d6..1019b3bc7a54 100644 --- a/sys/arm64/include/_types.h +++ b/sys/arm64/include/_types.h @@ -95,18 +95,4 @@ typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ #define __WCHAR_MAX __UINT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/mips/include/_types.h b/sys/mips/include/_types.h index 1f654c4894f5..31cdb6409353 100644 --- a/sys/mips/include/_types.h +++ b/sys/mips/include/_types.h @@ -150,18 +150,4 @@ typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h index 9ed2d8f62a13..83293a60e7d8 100644 --- a/sys/powerpc/include/_types.h +++ b/sys/powerpc/include/_types.h @@ -144,24 +144,4 @@ typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#if defined(__GNUCLIKE_BUILTIN_VARARGS) -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef struct { - char __gpr; - char __fpr; - char __pad[2]; - char *__stack; - char *__base; -} __va_list; -#endif /* post GCC 2.95 */ -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/riscv/include/_types.h b/sys/riscv/include/_types.h index 29e3c6a17427..0c4b6c775ab0 100644 --- a/sys/riscv/include/_types.h +++ b/sys/riscv/include/_types.h @@ -95,18 +95,4 @@ typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h index e029cac2455d..bd956b1ac77f 100644 --- a/sys/sparc64/include/_types.h +++ b/sys/sparc64/include/_types.h @@ -97,18 +97,4 @@ typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef char * __va_list; -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ -#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/sys/_types.h b/sys/sys/_types.h index 461636dba4f0..8ecf9d059239 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -122,6 +122,21 @@ typedef union { typedef __uintmax_t __rman_res_t; +/* + * Types for varargs. These are all provided by builtin types these + * days, so centralize their definition. + */ +#ifdef __GNUCLIKE_BUILTIN_VARARGS +typedef __builtin_va_list __va_list; /* internally known to gcc */ +#else +#error "No support for your compiler for stdargs" +#endif +#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ + && !defined(__NO_GNUC_VA_LIST) +#define __GNUC_VA_LIST +typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ +#endif + /* * When the following macro is defined, the system uses 64-bit inode numbers. * Programs can use this to avoid including , with its associated diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h index bfcfee98c026..b459951d0efe 100644 --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -143,26 +143,4 @@ typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VARARGS -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -#ifdef __LP64__ -struct __s_va_list { - __uint32_t _pad1[2]; /* gp_offset, fp_offset */ - __uint64_t _pad2[2]; /* overflow_arg_area, reg_save_area */ -}; -typedef struct __s_va_list __va_list; -#else -typedef char * __va_list; -#endif -#endif -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - #endif /* !_MACHINE__TYPES_H_ */