* libc/include/machine/_default_types.h: Move extern "C" after

header includes.  Include <sys/features.h> for
	__GNUC_PREREQ__().
	(__u?int.*_t): Define via GCC provided __U?INT.*_TYPE__ if
	available.
	(__intptr_t): Define.
	(__uintptr_t): Likewise.
	* libc/include/stdint.h: Include <machine/_default_types.h>
	instead of <_ansi.h>.
	(u?int.*_t): Define via __u?int.*_t provided by
	<machine/_default_types.h>.
	(u?int_fast.*_t): Define via GCC provided
	__U?INT_FAST.*_TYPE__ if available.
	(U?INT.*(MIN|MAX)): Define via GCC provided __U?INT.*(MIN|MAX)__
	if available.
	(U?INT.*_C): Define via GCC provided __U?INT.*_C if available.
	* libc/include/sys/cdefs.h: Use <machine/_default_types.h>
	instead of <stdint.h>.
	* libc/sys/rtems/sys/cpuset.h: Likewise.
	* libc/sys/rtems/machine/_types.h: Include <stdint.h> for
	FreeBSD compatibility.
This commit is contained in:
Corinna Vinschen 2013-12-03 16:04:41 +00:00
parent 9262c05537
commit 9bd3bcc642
6 changed files with 269 additions and 156 deletions

View File

@ -1,3 +1,27 @@
2013-12-03 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/machine/_default_types.h: Move extern "C" after
header includes. Include <sys/features.h> for
__GNUC_PREREQ__().
(__u?int.*_t): Define via GCC provided __U?INT.*_TYPE__ if
available.
(__intptr_t): Define.
(__uintptr_t): Likewise.
* libc/include/stdint.h: Include <machine/_default_types.h>
instead of <_ansi.h>.
(u?int.*_t): Define via __u?int.*_t provided by
<machine/_default_types.h>.
(u?int_fast.*_t): Define via GCC provided
__U?INT_FAST.*_TYPE__ if available.
(U?INT.*(MIN|MAX)): Define via GCC provided __U?INT.*(MIN|MAX)__
if available.
(U?INT.*_C): Define via GCC provided __U?INT.*_C if available.
* libc/include/sys/cdefs.h: Use <machine/_default_types.h>
instead of <stdint.h>.
* libc/sys/rtems/sys/cpuset.h: Likewise.
* libc/sys/rtems/machine/_types.h: Include <stdint.h> for
FreeBSD compatibility.
2013-11-29 Sebastian Huber <sebastian.huber@embedded-brains.de> 2013-11-29 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/pthread.h (pthread_cleanup_push): Delete prototype * libc/include/pthread.h (pthread_cleanup_push): Delete prototype

View File

@ -5,9 +5,7 @@
#ifndef _MACHINE__DEFAULT_TYPES_H #ifndef _MACHINE__DEFAULT_TYPES_H
#define _MACHINE__DEFAULT_TYPES_H #define _MACHINE__DEFAULT_TYPES_H
#ifdef __cplusplus #include <sys/features.h>
extern "C" {
#endif
/* /*
* Guess on types by examining *_MIN / *_MAX defines. * Guess on types by examining *_MIN / *_MAX defines.
@ -21,13 +19,25 @@ extern "C" {
#include <limits.h> #include <limits.h>
#endif #endif
#if __EXP(SCHAR_MAX) == 0x7f #ifdef __cplusplus
extern "C" {
#endif
#ifdef __INT8_TYPE__
typedef __INT8_TYPE__ __int8_t;
typedef __UINT8_TYPE__ __uint8_t;
#define ___int8_t_defined 1
#elif __EXP(SCHAR_MAX) == 0x7f
typedef signed char __int8_t ; typedef signed char __int8_t ;
typedef unsigned char __uint8_t ; typedef unsigned char __uint8_t ;
#define ___int8_t_defined 1 #define ___int8_t_defined 1
#endif #endif
#if __EXP(INT_MAX) == 0x7fff #ifdef __INT16_TYPE__
typedef __INT16_TYPE__ __int16_t;
typedef __UINT16_TYPE__ __uint16_t;
#define ___int16_t_defined 1
#elif __EXP(INT_MAX) == 0x7fff
typedef signed int __int16_t; typedef signed int __int16_t;
typedef unsigned int __uint16_t; typedef unsigned int __uint16_t;
#define ___int16_t_defined 1 #define ___int16_t_defined 1
@ -41,19 +51,11 @@ typedef unsigned char __uint16_t;
#define ___int16_t_defined 1 #define ___int16_t_defined 1
#endif #endif
#if ___int16_t_defined #ifdef __INT32_TYPE__
typedef __int16_t __int_least16_t; typedef __INT32_TYPE__ __int32_t;
typedef __uint16_t __uint_least16_t; typedef __UINT32_TYPE__ __uint32_t;
#define ___int_least16_t_defined 1 #define ___int32_t_defined 1
#elif __EXP(INT_MAX) == 0x7fffffffL
#if !___int8_t_defined
typedef __int16_t __int_least8_t;
typedef __uint16_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#endif
#if __EXP(INT_MAX) == 0x7fffffffL
typedef signed int __int32_t; typedef signed int __int32_t;
typedef unsigned int __uint32_t; typedef unsigned int __uint32_t;
#define ___int32_t_defined 1 #define ___int32_t_defined 1
@ -71,24 +73,11 @@ typedef unsigned char __uint32_t;
#define ___int32_t_defined 1 #define ___int32_t_defined 1
#endif #endif
#if ___int32_t_defined #ifdef __INT64_TYPE__
typedef __int32_t __int_least32_t; typedef __INT64_TYPE__ __int64_t;
typedef __uint32_t __uint_least32_t; typedef __UINT64_TYPE__ __uint64_t;
#define ___int_least32_t_defined 1 #define ___int64_t_defined 1
#elif __EXP(LONG_MAX) > 0x7fffffff
#if !___int8_t_defined
typedef __int32_t __int_least8_t;
typedef __uint32_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#if !___int16_t_defined
typedef __int32_t __int_least16_t;
typedef __uint32_t __uint_least16_t;
#define ___int_least16_t_defined 1
#endif
#endif
#if __EXP(LONG_MAX) > 0x7fffffff
typedef signed long __int64_t; typedef signed long __int64_t;
typedef unsigned long __uint64_t; typedef unsigned long __uint64_t;
#define ___int64_t_defined 1 #define ___int64_t_defined 1
@ -111,6 +100,81 @@ typedef unsigned int __uint64_t;
#define ___int64_t_defined 1 #define ___int64_t_defined 1
#endif #endif
#ifdef __INT_LEAST8_TYPE__
typedef __INT_LEAST8_TYPE__ __int_least8_t;
typedef __UINT_LEAST8_TYPE__ __uint_least8_t;
#define ___int_least8_t_defined 1
#elif defined(___int8_t_defined)
typedef __int8_t __int_least8_t;
typedef __uint8_t __uint_least8_t;
#define ___int_least8_t_defined 1
#elif defined(___int16_t_defined)
typedef __int16_t __int_least8_t;
typedef __uint16_t __uint_least8_t;
#define ___int_least8_t_defined 1
#elif defined(___int32_t_defined)
typedef __int32_t __int_least8_t;
typedef __uint32_t __uint_least8_t;
#define ___int_least8_t_defined 1
#elif defined(___int64_t_defined)
typedef __int64_t __int_least8_t;
typedef __uint64_t __uint_least8_t;
#define ___int_least8_t_defined 1
#endif
#ifdef __INT_LEAST16_TYPE__
typedef __INT_LEAST16_TYPE__ __int_least16_t;
typedef __UINT_LEAST16_TYPE__ __uint_least16_t;
#define ___int_least16_t_defined 1
#elif defined(___int16_t_defined)
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
#define ___int_least16_t_defined 1
#elif defined(___int32_t_defined)
typedef __int32_t __int_least16_t;
typedef __uint32_t __uint_least16_t;
#define ___int_least16_t_defined 1
#elif defined(___int64_t_defined)
typedef __int64_t __int_least16_t;
typedef __uint64_t __uint_least16_t;
#define ___int_least16_t_defined 1
#endif
#ifdef __INT_LEAST32_TYPE__
typedef __INT_LEAST32_TYPE__ __int_least32_t;
typedef __UINT_LEAST32_TYPE__ __uint_least32_t;
#define ___int_least32_t_defined 1
#elif defined(___int32_t_defined)
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
#define ___int_least32_t_defined 1
#elif defined(___int64_t_defined)
typedef __int64_t __int_least32_t;
typedef __uint64_t __uint_least32_t;
#define ___int_least32_t_defined 1
#endif
#ifdef __INT_LEAST64_TYPE__
typedef __INT_LEAST64_TYPE__ __int_least64_t;
typedef __UINT_LEAST64_TYPE__ __uint_least64_t;
#define ___int_least64_t_defined 1
#elif defined(___int64_t_defined)
typedef __int64_t __int_least64_t;
typedef __uint64_t __uint_least64_t;
#define ___int_least64_t_defined 1
#endif
#ifdef __INTPTR_TYPE__
typedef __INTPTR_TYPE__ __intptr_t;
typedef __UINTPTR_TYPE__ __uintptr_t;
#elif defined(__PTRDIFF_TYPE__)
typedef __PTRDIFF_TYPE__ __intptr_t;
typedef unsigned __PTRDIFF_TYPE__ __uintptr_t;
#else
typedef long __intptr_t;
typedef unsigned long __uintptr_t;
#endif
#undef __EXP #undef __EXP
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -9,7 +9,7 @@
#ifndef _STDINT_H #ifndef _STDINT_H
#define _STDINT_H #define _STDINT_H
#include <_ansi.h> #include <machine/_default_types.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -37,116 +37,52 @@ extern "C" {
#define __have_long32 1 #define __have_long32 1
#endif #endif
#if __STDINT_EXP(SCHAR_MAX) == 0x7f #ifdef ___int8_t_defined
typedef signed char int8_t ; typedef __int8_t int8_t ;
typedef unsigned char uint8_t ; typedef __uint8_t uint8_t ;
#define __int8_t_defined 1 #define __int8_t_defined 1
#endif #endif
#if __int8_t_defined #ifdef ___int_least8_t_defined
typedef signed char int_least8_t; typedef __int_least8_t int_least8_t;
typedef unsigned char uint_least8_t; typedef __uint_least8_t uint_least8_t;
#define __int_least8_t_defined 1 #define __int_least8_t_defined 1
#endif #endif
#if __STDINT_EXP(SHRT_MAX) == 0x7fff #ifdef ___int16_t_defined
typedef signed short int16_t; typedef __int16_t int16_t ;
typedef unsigned short uint16_t; typedef __uint16_t uint16_t ;
#define __int16_t_defined 1
#elif __STDINT_EXP(INT_MAX) == 0x7fff
typedef signed int int16_t;
typedef unsigned int uint16_t;
#define __int16_t_defined 1
#elif __STDINT_EXP(SCHAR_MAX) == 0x7fff
typedef signed char int16_t;
typedef unsigned char uint16_t;
#define __int16_t_defined 1 #define __int16_t_defined 1
#endif #endif
#if __int16_t_defined #ifdef ___int_least16_t_defined
typedef int16_t int_least16_t; typedef __int_least16_t int_least16_t;
typedef uint16_t uint_least16_t; typedef __uint_least16_t uint_least16_t;
#define __int_least16_t_defined 1 #define __int_least16_t_defined 1
#if !__int_least8_t_defined
typedef int16_t int_least8_t;
typedef uint16_t uint_least8_t;
#define __int_least8_t_defined 1
#endif
#endif #endif
#if __have_long32 #ifdef ___int32_t_defined
typedef signed long int32_t; typedef __int32_t int32_t ;
typedef unsigned long uint32_t; typedef __uint32_t uint32_t ;
#define __int32_t_defined 1
#elif __STDINT_EXP(INT_MAX) == 0x7fffffffL
typedef signed int int32_t;
typedef unsigned int uint32_t;
#define __int32_t_defined 1
#elif __STDINT_EXP(SHRT_MAX) == 0x7fffffffL
typedef signed short int32_t;
typedef unsigned short uint32_t;
#define __int32_t_defined 1
#elif __STDINT_EXP(SCHAR_MAX) == 0x7fffffffL
typedef signed char int32_t;
typedef unsigned char uint32_t;
#define __int32_t_defined 1 #define __int32_t_defined 1
#endif #endif
#if __int32_t_defined #ifdef ___int_least32_t_defined
typedef int32_t int_least32_t; typedef __int_least32_t int_least32_t;
typedef uint32_t uint_least32_t; typedef __uint_least32_t uint_least32_t;
#define __int_least32_t_defined 1 #define __int_least32_t_defined 1
#if !__int_least8_t_defined
typedef int32_t int_least8_t;
typedef uint32_t uint_least8_t;
#define __int_least8_t_defined 1
#endif #endif
#if !__int_least16_t_defined #ifdef ___int64_t_defined
typedef int32_t int_least16_t; typedef __int64_t int64_t ;
typedef uint32_t uint_least16_t; typedef __uint64_t uint64_t ;
#define __int_least16_t_defined 1
#endif
#endif
#if __have_long64
typedef signed long int64_t;
typedef unsigned long uint64_t;
#define __int64_t_defined 1
#elif __have_longlong64
typedef signed long long int64_t;
typedef unsigned long long uint64_t;
#define __int64_t_defined 1
#elif __STDINT_EXP(INT_MAX) > 0x7fffffff
typedef signed int int64_t;
typedef unsigned int uint64_t;
#define __int64_t_defined 1 #define __int64_t_defined 1
#endif #endif
#if __int64_t_defined #ifdef ___int_least64_t_defined
typedef int64_t int_least64_t; typedef __int_least64_t int_least64_t;
typedef uint64_t uint_least64_t; typedef __uint_least64_t uint_least64_t;
#define __int_least64_t_defined 1 #define __int_least64_t_defined 1
#if !__int_least8_t_defined
typedef int64_t int_least8_t;
typedef uint64_t uint_least8_t;
#define __int_least8_t_defined 1
#endif
#if !__int_least16_t_defined
typedef int64_t int_least16_t;
typedef uint64_t uint_least16_t;
#define __int_least16_t_defined 1
#endif
#if !__int_least32_t_defined
typedef int64_t int_least32_t;
typedef uint64_t uint_least32_t;
#define __int_least32_t_defined 1
#endif
#endif #endif
/* /*
@ -155,25 +91,41 @@ typedef uint64_t uint_least32_t;
* Assume int to be the fastest type for all types with a width * Assume int to be the fastest type for all types with a width
* less than __INT_MAX__ rsp. INT_MAX * less than __INT_MAX__ rsp. INT_MAX
*/ */
#if __STDINT_EXP(INT_MAX) >= 0x7f #ifdef __INT_FAST8_TYPE__
typedef __INT_FAST8_TYPE__ int_fast8_t;
typedef __UINT_FAST8_TYPE__ uint_fast8_t;
#define __int_fast8_t_defined 1
#elif __STDINT_EXP(INT_MAX) >= 0x7f
typedef signed int int_fast8_t; typedef signed int int_fast8_t;
typedef unsigned int uint_fast8_t; typedef unsigned int uint_fast8_t;
#define __int_fast8_t_defined 1 #define __int_fast8_t_defined 1
#endif #endif
#if __STDINT_EXP(INT_MAX) >= 0x7fff #ifdef __INT_FAST16_TYPE__
typedef __INT_FAST16_TYPE__ int_fast16_t;
typedef __UINT_FAST16_TYPE__ uint_fast16_t;
#define __int_fast16_t_defined 1
#elif __STDINT_EXP(INT_MAX) >= 0x7fff
typedef signed int int_fast16_t; typedef signed int int_fast16_t;
typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast16_t;
#define __int_fast16_t_defined 1 #define __int_fast16_t_defined 1
#endif #endif
#if __STDINT_EXP(INT_MAX) >= 0x7fffffff #ifdef __INT_FAST32_TYPE__
typedef __INT_FAST32_TYPE__ int_fast32_t;
typedef __UINT_FAST32_TYPE__ uint_fast32_t;
#define __int_fast32_t_defined 1
#elif __STDINT_EXP(INT_MAX) >= 0x7fffffff
typedef signed int int_fast32_t; typedef signed int int_fast32_t;
typedef unsigned int uint_fast32_t; typedef unsigned int uint_fast32_t;
#define __int_fast32_t_defined 1 #define __int_fast32_t_defined 1
#endif #endif
#if __STDINT_EXP(INT_MAX) > 0x7fffffff #ifdef __INT_FAST64_TYPE__
typedef __INT_FAST64_TYPE__ int_fast64_t;
typedef __UINT_FAST64_TYPE__ uint_fast64_t;
#define __int_fast64_t_defined 1
#elif __STDINT_EXP(INT_MAX) > 0x7fffffff
typedef signed int int_fast64_t; typedef signed int int_fast64_t;
typedef unsigned int uint_fast64_t; typedef unsigned int uint_fast64_t;
#define __int_fast64_t_defined 1 #define __int_fast64_t_defined 1
@ -235,13 +187,14 @@ typedef uint64_t uint_least32_t;
typedef unsigned long uintmax_t; typedef unsigned long uintmax_t;
#endif #endif
/* typedef __intptr_t intptr_t;
* GCC doesn't provide an appropriate macro for [u]intptr_t typedef __uintptr_t uintptr_t;
* For now, use __PTRDIFF_TYPE__
*/ #ifdef __INTPTR_TYPE__
#if defined(__PTRDIFF_TYPE__) #define INTPTR_MIN (-__INTPTR_MAX__ - 1)
typedef signed __PTRDIFF_TYPE__ intptr_t; #define INTPTR_MAX __INTPTR_MAX__
typedef unsigned __PTRDIFF_TYPE__ uintptr_t; #define UINTPTR_MAX __UINTPTR_MAX__
#elif defined(__PTRDIFF_TYPE__)
#define INTPTR_MAX PTRDIFF_MAX #define INTPTR_MAX PTRDIFF_MAX
#define INTPTR_MIN PTRDIFF_MIN #define INTPTR_MIN PTRDIFF_MIN
#ifdef __UINTPTR_MAX__ #ifdef __UINTPTR_MAX__
@ -254,8 +207,6 @@ typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
* Fallback to hardcoded values, * Fallback to hardcoded values,
* should be valid on cpu's with 32bit int/32bit void* * should be valid on cpu's with 32bit int/32bit void*
*/ */
typedef signed long intptr_t;
typedef unsigned long uintptr_t;
#define INTPTR_MAX __STDINT_EXP(LONG_MAX) #define INTPTR_MAX __STDINT_EXP(LONG_MAX)
#define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1) #define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
#define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1) #define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
@ -263,13 +214,21 @@ typedef unsigned long uintptr_t;
/* Limits of Specified-Width Integer Types */ /* Limits of Specified-Width Integer Types */
#if __int8_t_defined #ifdef __INT8_MAX__
#define INT8_MIN (-__INT8_MAX__ - 1)
#define INT8_MAX __INT8_MAX__
#define UINT8_MAX __UINT8_MAX__
#elif defined(__int8_t_defined)
#define INT8_MIN -128 #define INT8_MIN -128
#define INT8_MAX 127 #define INT8_MAX 127
#define UINT8_MAX 255 #define UINT8_MAX 255
#endif #endif
#if __int_least8_t_defined #ifdef __INT_LEAST8_MAX__
#define INT_LEAST8_MIN (-__INT_LEAST8_MAX__ - 1)
#define INT_LEAST8_MAX __INT_LEAST8_MAX__
#define UINT_LEAST8_MAX __UINT_LEAST8_MAX__
#elif defined(__int_least8_t_defined)
#define INT_LEAST8_MIN -128 #define INT_LEAST8_MIN -128
#define INT_LEAST8_MAX 127 #define INT_LEAST8_MAX 127
#define UINT_LEAST8_MAX 255 #define UINT_LEAST8_MAX 255
@ -277,13 +236,21 @@ typedef unsigned long uintptr_t;
#error required type int_least8_t missing #error required type int_least8_t missing
#endif #endif
#if __int16_t_defined #ifdef __INT16_MAX__
#define INT16_MIN (-__INT16_MAX__ - 1)
#define INT16_MAX __INT16_MAX__
#define UINT16_MAX __UINT16_MAX__
#elif defined(__int16_t_defined)
#define INT16_MIN -32768 #define INT16_MIN -32768
#define INT16_MAX 32767 #define INT16_MAX 32767
#define UINT16_MAX 65535 #define UINT16_MAX 65535
#endif #endif
#if __int_least16_t_defined #ifdef __INT_LEAST16_MAX__
#define INT_LEAST16_MIN (-__INT_LEAST16_MAX__ - 1)
#define INT_LEAST16_MAX __INT_LEAST16_MAX__
#define UINT_LEAST16_MAX __UINT_LEAST16_MAX__
#elif defined(__int_least16_t_defined)
#define INT_LEAST16_MIN -32768 #define INT_LEAST16_MIN -32768
#define INT_LEAST16_MAX 32767 #define INT_LEAST16_MAX 32767
#define UINT_LEAST16_MAX 65535 #define UINT_LEAST16_MAX 65535
@ -291,7 +258,11 @@ typedef unsigned long uintptr_t;
#error required type int_least16_t missing #error required type int_least16_t missing
#endif #endif
#if __int32_t_defined #ifdef __INT32_MAX__
#define INT32_MIN (-__INT32_MAX__ - 1)
#define INT32_MAX __INT32_MAX__
#define UINT32_MAX __UINT32_MAX__
#elif defined(__int32_t_defined)
#if __have_long32 #if __have_long32
#define INT32_MIN (-2147483647L-1) #define INT32_MIN (-2147483647L-1)
#define INT32_MAX 2147483647L #define INT32_MAX 2147483647L
@ -303,7 +274,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_least32_t_defined #ifdef __INT_LEAST32_MAX__
#define INT_LEAST32_MIN (-__INT_LEAST32_MAX__ - 1)
#define INT_LEAST32_MAX __INT_LEAST32_MAX__
#define UINT_LEAST32_MAX __UINT_LEAST32_MAX__
#elif defined(__int_least32_t_defined)
#if __have_long32 #if __have_long32
#define INT_LEAST32_MIN (-2147483647L-1) #define INT_LEAST32_MIN (-2147483647L-1)
#define INT_LEAST32_MAX 2147483647L #define INT_LEAST32_MAX 2147483647L
@ -317,7 +292,11 @@ typedef unsigned long uintptr_t;
#error required type int_least32_t missing #error required type int_least32_t missing
#endif #endif
#if __int64_t_defined #ifdef __INT64_MAX__
#define INT64_MIN (-__INT64_MAX__ - 1)
#define INT64_MAX __INT64_MAX__
#define UINT64_MAX __UINT64_MAX__
#elif defined(__int64_t_defined)
#if __have_long64 #if __have_long64
#define INT64_MIN (-9223372036854775807L-1L) #define INT64_MIN (-9223372036854775807L-1L)
#define INT64_MAX 9223372036854775807L #define INT64_MAX 9223372036854775807L
@ -329,7 +308,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_least64_t_defined #ifdef __INT_LEAST64_MAX__
#define INT_LEAST64_MIN (-__INT_LEAST64_MAX__ - 1)
#define INT_LEAST64_MAX __INT_LEAST64_MAX__
#define UINT_LEAST64_MAX __UINT_LEAST64_MAX__
#elif defined(__int_least64_t_defined)
#if __have_long64 #if __have_long64
#define INT_LEAST64_MIN (-9223372036854775807L-1L) #define INT_LEAST64_MIN (-9223372036854775807L-1L)
#define INT_LEAST64_MAX 9223372036854775807L #define INT_LEAST64_MAX 9223372036854775807L
@ -341,7 +324,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_fast8_t_defined #ifdef __INT_FAST8_MAX__
#define INT_FAST8_MIN (-__INT_FAST8_MAX__ - 1)
#define INT_FAST8_MAX __INT_FAST8_MAX__
#define UINT_FAST8_MAX __UINT_FAST8_MAX__
#elif defined(__int_fast8_t_defined)
#if __STDINT_EXP(INT_MAX) >= 0x7f #if __STDINT_EXP(INT_MAX) >= 0x7f
#define INT_FAST8_MIN (-__STDINT_EXP(INT_MAX)-1) #define INT_FAST8_MIN (-__STDINT_EXP(INT_MAX)-1)
#define INT_FAST8_MAX __STDINT_EXP(INT_MAX) #define INT_FAST8_MAX __STDINT_EXP(INT_MAX)
@ -353,7 +340,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_fast16_t_defined #ifdef __INT_FAST16_MAX__
#define INT_FAST16_MIN (-__INT_FAST16_MAX__ - 1)
#define INT_FAST16_MAX __INT_FAST16_MAX__
#define UINT_FAST16_MAX __UINT_FAST16_MAX__
#elif defined(__int_fast16_t_defined)
#if __STDINT_EXP(INT_MAX) >= 0x7fff #if __STDINT_EXP(INT_MAX) >= 0x7fff
#define INT_FAST16_MIN (-__STDINT_EXP(INT_MAX)-1) #define INT_FAST16_MIN (-__STDINT_EXP(INT_MAX)-1)
#define INT_FAST16_MAX __STDINT_EXP(INT_MAX) #define INT_FAST16_MAX __STDINT_EXP(INT_MAX)
@ -365,7 +356,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_fast32_t_defined #ifdef __INT_FAST32_MAX__
#define INT_FAST32_MIN (-__INT_FAST32_MAX__ - 1)
#define INT_FAST32_MAX __INT_FAST32_MAX__
#define UINT_FAST32_MAX __UINT_FAST32_MAX__
#elif defined(__int_fast32_t_defined)
#if __STDINT_EXP(INT_MAX) >= 0x7fffffff #if __STDINT_EXP(INT_MAX) >= 0x7fffffff
#define INT_FAST32_MIN (-__STDINT_EXP(INT_MAX)-1) #define INT_FAST32_MIN (-__STDINT_EXP(INT_MAX)-1)
#define INT_FAST32_MAX __STDINT_EXP(INT_MAX) #define INT_FAST32_MAX __STDINT_EXP(INT_MAX)
@ -377,7 +372,11 @@ typedef unsigned long uintptr_t;
#endif #endif
#endif #endif
#if __int_fast64_t_defined #ifdef __INT_FAST64_MAX__
#define INT_FAST64_MIN (-__INT_FAST64_MAX__ - 1)
#define INT_FAST64_MAX __INT_FAST64_MAX__
#define UINT_FAST64_MAX __UINT_FAST64_MAX__
#elif defined(__int_fast64_t_defined)
#if __STDINT_EXP(INT_MAX) > 0x7fffffff #if __STDINT_EXP(INT_MAX) > 0x7fffffff
#define INT_FAST64_MIN (-__STDINT_EXP(INT_MAX)-1) #define INT_FAST64_MIN (-__STDINT_EXP(INT_MAX)-1)
#define INT_FAST64_MAX __STDINT_EXP(INT_MAX) #define INT_FAST64_MAX __STDINT_EXP(INT_MAX)
@ -444,20 +443,34 @@ typedef unsigned long uintptr_t;
#endif #endif
/** Macros for minimum-width integer constant expressions */ /** Macros for minimum-width integer constant expressions */
#ifdef __INT8_C
#define INT8_C(x) __INT8_C(x)
#define UINT8_C(x) __UINT8_C(x)
#else
#define INT8_C(x) x #define INT8_C(x) x
#if __STDINT_EXP(INT_MAX) > 0x7f #if __STDINT_EXP(INT_MAX) > 0x7f
#define UINT8_C(x) x #define UINT8_C(x) x
#else #else
#define UINT8_C(x) x##U #define UINT8_C(x) x##U
#endif #endif
#endif
#ifdef __INT16_C
#define INT16_C(x) __INT16_C(x)
#define UINT16_C(x) __UINT16_C(x)
#else
#define INT16_C(x) x #define INT16_C(x) x
#if __STDINT_EXP(INT_MAX) > 0x7fff #if __STDINT_EXP(INT_MAX) > 0x7fff
#define UINT16_C(x) x #define UINT16_C(x) x
#else #else
#define UINT16_C(x) x##U #define UINT16_C(x) x##U
#endif #endif
#endif
#ifdef __INT32_C
#define INT32_C(x) __INT32_C(x)
#define UINT32_C(x) __UINT32_C(x)
#else
#if __have_long32 #if __have_long32
#define INT32_C(x) x##L #define INT32_C(x) x##L
#define UINT32_C(x) x##UL #define UINT32_C(x) x##UL
@ -465,7 +478,12 @@ typedef unsigned long uintptr_t;
#define INT32_C(x) x #define INT32_C(x) x
#define UINT32_C(x) x##U #define UINT32_C(x) x##U
#endif #endif
#endif
#ifdef __INT64_C
#define INT64_C(x) __INT64_C(x)
#define UINT64_C(x) __UINT64_C(x)
#else
#if __int64_t_defined #if __int64_t_defined
#if __have_long64 #if __have_long64
#define INT64_C(x) x##L #define INT64_C(x) x##L
@ -475,8 +493,13 @@ typedef unsigned long uintptr_t;
#define UINT64_C(x) x##ULL #define UINT64_C(x) x##ULL
#endif #endif
#endif #endif
#endif
/** Macros for greatest-width integer constant expression */ /** Macros for greatest-width integer constant expression */
#ifdef __INTMAX_C
#define INTMAX_C(x) __INTMAX_C(x)
#define UINTMAX_C(x) __UINTMAX_C(x)
#else
#if __have_long64 #if __have_long64
#define INTMAX_C(x) x##L #define INTMAX_C(x) x##L
#define UINTMAX_C(x) x##UL #define UINTMAX_C(x) x##UL
@ -484,6 +507,7 @@ typedef unsigned long uintptr_t;
#define INTMAX_C(x) x##LL #define INTMAX_C(x) x##LL
#define UINTMAX_C(x) x##ULL #define UINTMAX_C(x) x##ULL
#endif #endif
#endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -40,9 +40,9 @@
#ifndef _SYS_CDEFS_H_ #ifndef _SYS_CDEFS_H_
#define _SYS_CDEFS_H_ #define _SYS_CDEFS_H_
#include <machine/_default_types.h>
#include <sys/features.h> #include <sys/features.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#define __PMT(args) args #define __PMT(args) args
#define __DOTS , ... #define __DOTS , ...
@ -572,15 +572,15 @@
#endif #endif
#ifndef __DECONST #ifndef __DECONST
#define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var)) #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
#endif #endif
#ifndef __DEVOLATILE #ifndef __DEVOLATILE
#define __DEVOLATILE(type, var) ((type)(uintptr_t)(volatile void *)(var)) #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
#endif #endif
#ifndef __DEQUALIFY #ifndef __DEQUALIFY
#define __DEQUALIFY(type, var) ((type)(uintptr_t)(const volatile void *)(var)) #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
#endif #endif
/*- /*-

View File

@ -9,6 +9,7 @@
#define _HAVE_SYSTYPES #define _HAVE_SYSTYPES
#include <machine/_default_types.h> #include <machine/_default_types.h>
#include <stdint.h> /* For FreeBSD compatibility */
typedef __int32_t blksize_t; typedef __int32_t blksize_t;
typedef __int32_t blkcnt_t; typedef __int32_t blkcnt_t;

View File

@ -45,8 +45,8 @@
#ifndef _SYS_CPUSET_H_ #ifndef _SYS_CPUSET_H_
#define _SYS_CPUSET_H_ #define _SYS_CPUSET_H_
#include <machine/_default_types.h>
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -58,7 +58,7 @@ extern "C" {
#endif #endif
/* word in the cpu set */ /* word in the cpu set */
typedef uint32_t cpu_set_word_t; typedef __uint32_t cpu_set_word_t;
/* Number of bits per cpu_set_t element */ /* Number of bits per cpu_set_t element */
#define _NCPUBITS (sizeof(cpu_set_word_t) * 8) #define _NCPUBITS (sizeof(cpu_set_word_t) * 8)