Always define the 64-bit int types.
These preprocessor tricks have caused trouble for -std=gnu99 and -ansi, and both netbsd's libc and glibc seem to unconditionally define these types. Change-Id: Ib8dffa341a8ca88f80d275ba2b7f93a4c910ee32
This commit is contained in:
parent
1771a33d11
commit
6d6731adc0
@ -31,8 +31,6 @@
|
||||
#include <stddef.h>
|
||||
#include <sys/_types.h>
|
||||
|
||||
|
||||
|
||||
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDINT_LIMITS
|
||||
#endif
|
||||
@ -41,20 +39,14 @@
|
||||
# define __STDINT_MACROS
|
||||
#endif
|
||||
|
||||
#if !defined __STRICT_ANSI__ || __STDC_VERSION__ >= 199901L
|
||||
# define __STDC_INT64__
|
||||
#endif
|
||||
|
||||
typedef __int8_t int8_t;
|
||||
typedef __uint8_t uint8_t;
|
||||
typedef __int16_t int16_t;
|
||||
typedef __uint16_t uint16_t;
|
||||
typedef __int32_t int32_t;
|
||||
typedef __uint32_t uint32_t;
|
||||
#if defined(__STDC_INT64__)
|
||||
typedef __int64_t int64_t;
|
||||
typedef __uint64_t uint64_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* int8_t & uint8_t
|
||||
@ -93,7 +85,6 @@ typedef uint8_t uint_fast8_t;
|
||||
* int16_t & uint16_t
|
||||
*/
|
||||
|
||||
|
||||
typedef int16_t int_least16_t;
|
||||
typedef int32_t int_fast16_t;
|
||||
|
||||
@ -156,17 +147,16 @@ typedef uint32_t uint_fast32_t;
|
||||
# define UINT_FAST32_C(c) UINT32_C(c)
|
||||
#endif
|
||||
|
||||
#if defined(__STDC_INT64__)
|
||||
/*
|
||||
* int64_t
|
||||
*/
|
||||
|
||||
typedef int64_t int_least64_t;
|
||||
typedef int64_t int_fast64_t;
|
||||
|
||||
typedef uint64_t uint_least64_t;
|
||||
typedef uint64_t uint_fast64_t;
|
||||
|
||||
|
||||
#ifdef __STDINT_LIMITS
|
||||
# define INT64_MIN (__INT64_C(-9223372036854775807)-1)
|
||||
# define INT64_MAX (__INT64_C(9223372036854775807))
|
||||
@ -193,13 +183,10 @@ typedef uint64_t uint_fast64_t;
|
||||
# define UINT_FAST64_C(c) UINT64_C(c)
|
||||
#endif
|
||||
|
||||
|
||||
# define __PRI64_RANK "ll"
|
||||
# define __PRIFAST_RANK ""
|
||||
# define __PRIPTR_RANK ""
|
||||
|
||||
#endif /* __STDC_INT64__ */
|
||||
|
||||
/*
|
||||
* intptr_t & uintptr_t
|
||||
*/
|
||||
@ -221,14 +208,10 @@ typedef unsigned int uintptr_t;
|
||||
# define PTRDIFF_C(c) INT32_C(c)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* intmax_t & uintmax_t
|
||||
*/
|
||||
|
||||
#if defined(__STDC_INT64__)
|
||||
|
||||
typedef uint64_t uintmax_t;
|
||||
typedef int64_t intmax_t;
|
||||
|
||||
@ -243,25 +226,6 @@ typedef int64_t intmax_t;
|
||||
# define UINTMAX_C(c) UINT64_C(c)
|
||||
#endif
|
||||
|
||||
#else /* !__STDC_INT64__ */
|
||||
|
||||
typedef uint32_t uintmax_t;
|
||||
typedef int32_t intmax_t;
|
||||
|
||||
#ifdef __STDINT_LIMITS
|
||||
# define INTMAX_MIN INT32_MIN
|
||||
# define INTMAX_MAX INT32_MAX
|
||||
# define UINTMAX_MAX UINT32_MAX
|
||||
#endif
|
||||
|
||||
#ifdef __STDINT_MACROS
|
||||
# define INTMAX_C(c) INT32_C(c)
|
||||
# define UINTMAX_C(c) UINT32_C(c)
|
||||
#endif
|
||||
|
||||
#endif /* !__STDC_INT64__ */
|
||||
|
||||
|
||||
/* size_t is defined by the GCC-specific <stddef.h> */
|
||||
#ifndef _SSIZE_T_DEFINED_
|
||||
#define _SSIZE_T_DEFINED_
|
||||
|
Loading…
Reference in New Issue
Block a user