diff --git a/include/pthread.h b/include/pthread.h --- a/include/pthread.h +++ b/include/pthread.h @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -41,30 +41,10 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef long long __int64_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef unsigned long long __uint64_t; - /* * Standard type definitions. */ @@ -74,38 +54,19 @@ typedef double __double_t; typedef float __float_t; #endif -typedef __int32_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int32_t __intptr_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int32_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ -typedef __uint32_t __size_t; /* sizeof() */ -typedef __int32_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ -typedef __uint32_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint32_t __uintptr_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; typedef __uint32_t __u_register_t; -typedef __uint32_t __vm_offset_t; typedef __uint32_t __vm_paddr_t; -typedef __uint32_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h --- a/sys/arm64/include/_types.h +++ b/sys/arm64/include/_types.h @@ -35,22 +35,10 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - /* * Standard type definitions. */ @@ -60,38 +48,19 @@ typedef double __double_t; typedef float __float_t; #endif -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_size_t; typedef unsigned int ___wchar_t; #define __WCHAR_MIN 0 /* min value for a wchar_t */ diff --git a/sys/mips/include/_types.h b/sys/mips/include/_types.h --- a/sys/mips/include/_types.h +++ b/sys/mips/include/_types.h @@ -42,33 +42,8 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -#ifdef __mips_n64 -typedef long __int64_t; -typedef unsigned long __uint64_t; -#else -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef long long __int64_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef unsigned long long __uint64_t; +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif /* @@ -81,22 +56,13 @@ #endif #ifdef __mips_n64 typedef __int64_t __critical_t; -typedef __int64_t __intfptr_t; -typedef __int64_t __intptr_t; #else typedef __int32_t __critical_t; -typedef __int32_t __intfptr_t; -typedef __int32_t __intptr_t; #endif -typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; #if defined(__mips_n64) || defined(__mips_n32) typedef __int64_t __register_t; typedef __int64_t f_register_t; @@ -105,42 +71,20 @@ typedef __int32_t f_register_t; #endif #ifdef __mips_n64 -typedef __int64_t __ptrdiff_t; typedef __int64_t __segsz_t; -typedef __uint64_t __size_t; -typedef __int64_t __ssize_t; -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintptr_t; #else -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int32_t __segsz_t; /* segment size (in pages) */ -typedef __uint32_t __size_t; /* sizeof() */ -typedef __int32_t __ssize_t; /* byte count or error */ -typedef __uint32_t __uintfptr_t; -typedef __uint32_t __uintptr_t; #endif typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; #if defined(__mips_n64) || defined(__mips_n32) typedef __uint64_t __u_register_t; #else typedef __uint32_t __u_register_t; #endif -#ifdef __mips_n64 -typedef __uint64_t __vm_offset_t; -typedef __uint64_t __vm_size_t; -#else -typedef __uint32_t __vm_offset_t; -typedef __uint32_t __vm_size_t; -#endif #if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */ typedef __uint64_t __vm_paddr_t; #else diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h --- a/sys/powerpc/include/_types.h +++ b/sys/powerpc/include/_types.h @@ -41,33 +41,8 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -#ifdef __LP64__ -typedef long __int64_t; -typedef unsigned long __uint64_t; -#else -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef long long __int64_t; -#ifndef lint -__extension__ -#endif -/* LONGLONG */ -typedef unsigned long long __uint64_t; +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif /* @@ -80,66 +55,35 @@ #endif #ifdef __LP64__ typedef __int64_t __critical_t; -typedef __int64_t __intfptr_t; -typedef __int64_t __intptr_t; #else typedef __int32_t __critical_t; -typedef __int32_t __intfptr_t; -typedef __int32_t __intptr_t; #endif -typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; #ifdef __LP64__ -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ #else -typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int32_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ -typedef __uint32_t __size_t; /* sizeof() */ -typedef __int32_t __ssize_t; /* byte count or error */ #endif typedef __int64_t __time_t; /* time()... */ -#ifdef __LP64__ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintptr_t; -#else -typedef __uint32_t __uintfptr_t; -typedef __uint32_t __uintptr_t; -#endif -typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; #ifdef __LP64__ typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_size_t; #else typedef __uint32_t __u_register_t; -typedef __uint32_t __vm_offset_t; #ifdef BOOKE typedef __uint64_t __vm_paddr_t; #else typedef __uint32_t __vm_paddr_t; #endif -typedef __uint32_t __vm_size_t; #endif typedef int ___wchar_t; diff --git a/sys/riscv/include/_types.h b/sys/riscv/include/_types.h --- a/sys/riscv/include/_types.h +++ b/sys/riscv/include/_types.h @@ -35,22 +35,10 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - /* * Standard type definitions. */ @@ -60,38 +48,19 @@ typedef double __double_t; typedef float __float_t; #endif -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_size_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ diff --git a/sys/sys/_types.h b/sys/sys/_types.h --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -32,6 +32,84 @@ #define _SYS__TYPES_H_ #include + +/* + * Basic types upon which most other types are built. + * + * Note: It would be nice to simply use the compiler-provided __FOO_TYPE__ + * macros. However, in order to do so we have to check that those match the + * previous typedefs exactly (not just that they have the same size) since any + * change would be an ABI break. For example, changing `long` to `long long` + * results in different C++ name mangling. + */ +typedef signed char __int8_t; +typedef unsigned char __uint8_t; +typedef short __int16_t; +typedef unsigned short __uint16_t; +typedef int __int32_t; +typedef unsigned int __uint32_t; +#if __SIZEOF_LONG__ == 8 +typedef long __int64_t; +typedef unsigned long __uint64_t; +#elif __SIZEOF_LONG__ == 4 +__extension__ +typedef long long __int64_t; +__extension__ +typedef unsigned long long __uint64_t; +#else +#error unsupported long size +#endif + +typedef __int8_t __int_least8_t; +typedef __int16_t __int_least16_t; +typedef __int32_t __int_least32_t; +typedef __int64_t __int_least64_t; +typedef __int64_t __intmax_t; +typedef __uint8_t __uint_least8_t; +typedef __uint16_t __uint_least16_t; +typedef __uint32_t __uint_least32_t; +typedef __uint64_t __uint_least64_t; +typedef __uint64_t __uintmax_t; + +#if __SIZEOF_POINTER__ == 8 +typedef __int64_t __intptr_t; +typedef __int64_t __intfptr_t; +typedef __uint64_t __uintptr_t; +typedef __uint64_t __uintfptr_t; +typedef __uint64_t __vm_offset_t; +typedef __uint64_t __vm_size_t; +#elif __SIZEOF_POINTER__ == 4 +typedef __int32_t __intptr_t; +typedef __int32_t __intfptr_t; +typedef __uint32_t __uintptr_t; +typedef __uint32_t __uintfptr_t; +typedef __uint32_t __vm_offset_t; +typedef __uint32_t __vm_size_t; +#else +#error unsupported pointer size +#endif + +#if __SIZEOF_SIZE_T__ == 8 +typedef __uint64_t __size_t; /* sizeof() */ +typedef __int64_t __ssize_t; /* byte count or error */ +#elif __SIZEOF_SIZE_T__ == 4 +typedef __uint32_t __size_t; /* sizeof() */ +typedef __int32_t __ssize_t; /* byte count or error */ +#else +#error unsupported size_t size +#endif + +#if __SIZEOF_PTRDIFF_T__ == 8 +typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ +#elif __SIZEOF_PTRDIFF_T__ == 4 +typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ +#else +#error unsupported ptrdiff_t size +#endif + +/* + * Target-dependent type definitions. + */ #include /* diff --git a/sys/sys/stddef.h b/sys/sys/stddef.h --- a/sys/sys/stddef.h +++ b/sys/sys/stddef.h @@ -33,7 +33,7 @@ #include #include -#include +#include #ifndef _PTRDIFF_T_DECLARED typedef __ptrdiff_t ptrdiff_t; diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -41,33 +41,14 @@ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite +#ifndef _SYS__TYPES_H_ +#error do not include this header, use sys/_types.h #endif #include #define __NO_STRICT_ALIGNMENT -/* - * Basic types upon which most other types are built. - */ -typedef signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -#ifdef __LP64__ -typedef long __int64_t; -typedef unsigned long __uint64_t; -#else -__extension__ -typedef long long __int64_t; -__extension__ -typedef unsigned long long __uint64_t; -#endif - /* * Standard type definitions. */ @@ -78,8 +59,6 @@ typedef double __double_t; typedef float __float_t; #endif -typedef __int64_t __intfptr_t; -typedef __int64_t __intptr_t; #else typedef unsigned long __clock_t; typedef __int32_t __critical_t; @@ -87,56 +66,30 @@ typedef long double __double_t; typedef long double __float_t; #endif -typedef __int32_t __intfptr_t; -typedef __int32_t __intptr_t; #endif -typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; #ifdef __LP64__ -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ typedef __int64_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintptr_t; #else -typedef __int32_t __ptrdiff_t; typedef __int32_t __register_t; typedef __int32_t __segsz_t; -typedef __uint32_t __size_t; -typedef __int32_t __ssize_t; typedef __int32_t __time_t; -typedef __uint32_t __uintfptr_t; -typedef __uint32_t __uintptr_t; #endif -typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; #ifdef __LP64__ typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_size_t; #else typedef __uint32_t __u_register_t; -typedef __uint32_t __vm_offset_t; typedef __uint64_t __vm_paddr_t; -typedef __uint32_t __vm_size_t; #endif typedef int ___wchar_t; diff --git a/sys/x86/include/reg.h b/sys/x86/include/reg.h --- a/sys/x86/include/reg.h +++ b/sys/x86/include/reg.h @@ -39,7 +39,7 @@ #ifndef _MACHINE_REG_H_ #define _MACHINE_REG_H_ -#include +#include #ifdef __i386__ /*