Add parens around MIN/MAX values in stdint.h.

* libc/include/stdint.h: Throughout add parens around MIN/MAX values.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2015-04-01 20:40:43 +02:00
parent b5fdd3cd8e
commit d41baf3578
No known key found for this signature in database
GPG Key ID: F536069DAE444FA0
2 changed files with 75 additions and 71 deletions

View File

@ -1,3 +1,7 @@
2015-04-01 Corinna Vinschen <vinschen@redhat.com>
* libc/include/stdint.h: Throughout add parens around MIN/MAX values.
2015-04-01 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libc/include/sys/_stdint.h: New file.

View File

@ -145,13 +145,13 @@ typedef __uint_least64_t uint_least64_t;
#ifdef __INTPTR_TYPE__
#define INTPTR_MIN (-__INTPTR_MAX__ - 1)
#define INTPTR_MAX __INTPTR_MAX__
#define UINTPTR_MAX __UINTPTR_MAX__
#define INTPTR_MAX (__INTPTR_MAX__)
#define UINTPTR_MAX (__UINTPTR_MAX__)
#elif defined(__PTRDIFF_TYPE__)
#define INTPTR_MAX PTRDIFF_MAX
#define INTPTR_MIN PTRDIFF_MIN
#ifdef __UINTPTR_MAX__
#define UINTPTR_MAX __UINTPTR_MAX__
#define UINTPTR_MAX (__UINTPTR_MAX__)
#else
#define UINTPTR_MAX (2UL * PTRDIFF_MAX + 1)
#endif
@ -160,7 +160,7 @@ typedef __uint_least64_t uint_least64_t;
* Fallback to hardcoded values,
* should be valid on cpu's with 32bit int/32bit void*
*/
#define INTPTR_MAX __STDINT_EXP(LONG_MAX)
#define INTPTR_MAX (__STDINT_EXP(LONG_MAX))
#define INTPTR_MIN (-__STDINT_EXP(LONG_MAX) - 1)
#define UINTPTR_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
#endif
@ -169,77 +169,77 @@ typedef __uint_least64_t uint_least64_t;
#ifdef __INT8_MAX__
#define INT8_MIN (-__INT8_MAX__ - 1)
#define INT8_MAX __INT8_MAX__
#define UINT8_MAX __UINT8_MAX__
#define INT8_MAX (__INT8_MAX__)
#define UINT8_MAX (__UINT8_MAX__)
#elif defined(__int8_t_defined)
#define INT8_MIN -128
#define INT8_MAX 127
#define UINT8_MAX 255
#define INT8_MIN (-128)
#define INT8_MAX (127)
#define UINT8_MAX (255)
#endif
#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__
#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_MAX 127
#define UINT_LEAST8_MAX 255
#define INT_LEAST8_MIN (-128)
#define INT_LEAST8_MAX (127)
#define UINT_LEAST8_MAX (255)
#else
#error required type int_least8_t missing
#endif
#ifdef __INT16_MAX__
#define INT16_MIN (-__INT16_MAX__ - 1)
#define INT16_MAX __INT16_MAX__
#define UINT16_MAX __UINT16_MAX__
#define INT16_MAX (__INT16_MAX__)
#define UINT16_MAX (__UINT16_MAX__)
#elif defined(__int16_t_defined)
#define INT16_MIN -32768
#define INT16_MAX 32767
#define UINT16_MAX 65535
#define INT16_MIN (-32768)
#define INT16_MAX (32767)
#define UINT16_MAX (65535)
#endif
#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__
#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_MAX 32767
#define UINT_LEAST16_MAX 65535
#define INT_LEAST16_MIN (-32768)
#define INT_LEAST16_MAX (32767)
#define UINT_LEAST16_MAX (65535)
#else
#error required type int_least16_t missing
#endif
#ifdef __INT32_MAX__
#define INT32_MIN (-__INT32_MAX__ - 1)
#define INT32_MAX __INT32_MAX__
#define UINT32_MAX __UINT32_MAX__
#define INT32_MAX (__INT32_MAX__)
#define UINT32_MAX (__UINT32_MAX__)
#elif defined(__int32_t_defined)
#if __have_long32
#define INT32_MIN (-2147483647L-1)
#define INT32_MAX 2147483647L
#define UINT32_MAX 4294967295UL
#define INT32_MAX (2147483647L)
#define UINT32_MAX (4294967295UL)
#else
#define INT32_MIN (-2147483647-1)
#define INT32_MAX 2147483647
#define UINT32_MAX 4294967295U
#define INT32_MAX (2147483647)
#define UINT32_MAX (4294967295U)
#endif
#endif
#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__
#define INT_LEAST32_MAX (__INT_LEAST32_MAX__)
#define UINT_LEAST32_MAX (__UINT_LEAST32_MAX__)
#elif defined(__int_least32_t_defined)
#if __have_long32
#define INT_LEAST32_MIN (-2147483647L-1)
#define INT_LEAST32_MAX 2147483647L
#define UINT_LEAST32_MAX 4294967295UL
#define INT_LEAST32_MAX (2147483647L)
#define UINT_LEAST32_MAX (4294967295UL)
#else
#define INT_LEAST32_MIN (-2147483647-1)
#define INT_LEAST32_MAX 2147483647
#define UINT_LEAST32_MAX 4294967295U
#define INT_LEAST32_MAX (2147483647)
#define UINT_LEAST32_MAX (4294967295U)
#endif
#else
#error required type int_least32_t missing
@ -247,44 +247,44 @@ typedef __uint_least64_t uint_least64_t;
#ifdef __INT64_MAX__
#define INT64_MIN (-__INT64_MAX__ - 1)
#define INT64_MAX __INT64_MAX__
#define UINT64_MAX __UINT64_MAX__
#define INT64_MAX (__INT64_MAX__)
#define UINT64_MAX (__UINT64_MAX__)
#elif defined(__int64_t_defined)
#if __have_long64
#define INT64_MIN (-9223372036854775807L-1L)
#define INT64_MAX 9223372036854775807L
#define UINT64_MAX 18446744073709551615U
#define INT64_MAX (9223372036854775807L)
#define UINT64_MAX (18446744073709551615U)
#elif __have_longlong64
#define INT64_MIN (-9223372036854775807LL-1LL)
#define INT64_MAX 9223372036854775807LL
#define UINT64_MAX 18446744073709551615ULL
#define INT64_MAX (9223372036854775807LL)
#define UINT64_MAX (18446744073709551615ULL)
#endif
#endif
#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__
#define INT_LEAST64_MAX (__INT_LEAST64_MAX__)
#define UINT_LEAST64_MAX (__UINT_LEAST64_MAX__)
#elif defined(__int_least64_t_defined)
#if __have_long64
#define INT_LEAST64_MIN (-9223372036854775807L-1L)
#define INT_LEAST64_MAX 9223372036854775807L
#define UINT_LEAST64_MAX 18446744073709551615U
#define INT_LEAST64_MAX (9223372036854775807L)
#define UINT_LEAST64_MAX (18446744073709551615U)
#elif __have_longlong64
#define INT_LEAST64_MIN (-9223372036854775807LL-1LL)
#define INT_LEAST64_MAX 9223372036854775807LL
#define UINT_LEAST64_MAX 18446744073709551615ULL
#define INT_LEAST64_MAX (9223372036854775807LL)
#define UINT_LEAST64_MAX (18446744073709551615ULL)
#endif
#endif
#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__
#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
#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))
#define UINT_FAST8_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
#else
#define INT_FAST8_MIN INT_LEAST8_MIN
@ -295,12 +295,12 @@ typedef __uint_least64_t uint_least64_t;
#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__
#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
#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))
#define UINT_FAST16_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
#else
#define INT_FAST16_MIN INT_LEAST16_MIN
@ -311,12 +311,12 @@ typedef __uint_least64_t uint_least64_t;
#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__
#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
#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))
#define UINT_FAST32_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
#else
#define INT_FAST32_MIN INT_LEAST32_MIN
@ -327,12 +327,12 @@ typedef __uint_least64_t uint_least64_t;
#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__
#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
#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))
#define UINT_FAST64_MAX (__STDINT_EXP(INT_MAX)*2U+1U)
#else
#define INT_FAST64_MIN INT_LEAST64_MIN
@ -342,7 +342,7 @@ typedef __uint_least64_t uint_least64_t;
#endif
#ifdef __INTMAX_MAX__
#define INTMAX_MAX __INTMAX_MAX__
#define INTMAX_MAX (__INTMAX_MAX__)
#define INTMAX_MIN (-INTMAX_MAX - 1)
#elif defined(__INTMAX_TYPE__)
/* All relevant GCC versions prefer long to long long for intmax_t. */
@ -351,7 +351,7 @@ typedef __uint_least64_t uint_least64_t;
#endif
#ifdef __UINTMAX_MAX__
#define UINTMAX_MAX __UINTMAX_MAX__
#define UINTMAX_MAX (__UINTMAX_MAX__)
#elif defined(__UINTMAX_TYPE__)
/* All relevant GCC versions prefer long to long long for intmax_t. */
#define UINTMAX_MAX UINT64_MAX
@ -359,27 +359,27 @@ typedef __uint_least64_t uint_least64_t;
/* This must match size_t in stddef.h, currently long unsigned int */
#ifdef __SIZE_MAX__
#define SIZE_MAX __SIZE_MAX__
#define SIZE_MAX (__SIZE_MAX__)
#else
#define SIZE_MAX (__STDINT_EXP(LONG_MAX) * 2UL + 1)
#endif
/* This must match sig_atomic_t in <signal.h> (currently int) */
#define SIG_ATOMIC_MIN (-__STDINT_EXP(INT_MAX) - 1)
#define SIG_ATOMIC_MAX __STDINT_EXP(INT_MAX)
#define SIG_ATOMIC_MAX (__STDINT_EXP(INT_MAX))
/* This must match ptrdiff_t in <stddef.h> (currently long int) */
#ifdef __PTRDIFF_MAX__
#define PTRDIFF_MAX __PTRDIFF_MAX__
#define PTRDIFF_MAX (__PTRDIFF_MAX__)
#else
#define PTRDIFF_MAX __STDINT_EXP(LONG_MAX)
#define PTRDIFF_MAX (__STDINT_EXP(LONG_MAX))
#endif
#define PTRDIFF_MIN (-PTRDIFF_MAX - 1)
/* This must match definition in <wchar.h> */
#ifndef WCHAR_MIN
#ifdef __WCHAR_MIN__
#define WCHAR_MIN __WCHAR_MIN__
#define WCHAR_MIN (__WCHAR_MIN__)
#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
#define WCHAR_MIN (0 + L'\0')
#else
@ -390,7 +390,7 @@ typedef __uint_least64_t uint_least64_t;
/* This must match definition in <wchar.h> */
#ifndef WCHAR_MAX
#ifdef __WCHAR_MAX__
#define WCHAR_MAX __WCHAR_MAX__
#define WCHAR_MAX (__WCHAR_MAX__)
#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0)
#define WCHAR_MAX (0xffffffffu + L'\0')
#else
@ -400,14 +400,14 @@ typedef __uint_least64_t uint_least64_t;
/* wint_t is unsigned int on almost all GCC targets. */
#ifdef __WINT_MAX__
#define WINT_MAX __WINT_MAX__
#define WINT_MAX (__WINT_MAX__)
#else
#define WINT_MAX (__STDINT_EXP(INT_MAX) * 2U + 1U)
#endif
#ifdef __WINT_MIN__
#define WINT_MIN __WINT_MIN__
#define WINT_MIN (__WINT_MIN__)
#else
#define WINT_MIN 0U
#define WINT_MIN (0U)
#endif
/** Macros for minimum-width integer constant expressions */