From 17ff765184829731ca171ddcbcba19bf92b84202 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 4 Mar 2014 08:05:39 +0000 Subject: * libc/include/machine/_default_types.h: Define unsigned type using signed type macros in case unsigned type macros are not available. --- newlib/ChangeLog | 5 ++++ newlib/libc/include/machine/_default_types.h | 36 ++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1372633..2b06b4e 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2014-03-04 Ed Nelson + + * libc/include/machine/_default_types.h: Define unsigned type using + signed type macros in case unsigned type macros are not available. + 2014-02-20 Agustin Henze * libm/complex/complex.tex: Fix wrong syntax in documentation. diff --git a/newlib/libc/include/machine/_default_types.h b/newlib/libc/include/machine/_default_types.h index 2bd5f64..ffc646d 100644 --- a/newlib/libc/include/machine/_default_types.h +++ b/newlib/libc/include/machine/_default_types.h @@ -25,7 +25,11 @@ extern "C" { #ifdef __INT8_TYPE__ typedef __INT8_TYPE__ __int8_t; +#ifdef __UINT8_TYPE__ typedef __UINT8_TYPE__ __uint8_t; +#else +typedef unsigned __INT8_TYPE__ __uint8_t; +#endif #define ___int8_t_defined 1 #elif __EXP(SCHAR_MAX) == 0x7f typedef signed char __int8_t ; @@ -35,7 +39,11 @@ typedef unsigned char __uint8_t ; #ifdef __INT16_TYPE__ typedef __INT16_TYPE__ __int16_t; +#ifdef __UINT16_TYPE__ typedef __UINT16_TYPE__ __uint16_t; +#else +typedef unsigned __INT16_TYPE__ __uint16_t; +#endif #define ___int16_t_defined 1 #elif __EXP(INT_MAX) == 0x7fff typedef signed int __int16_t; @@ -53,7 +61,11 @@ typedef unsigned char __uint16_t; #ifdef __INT32_TYPE__ typedef __INT32_TYPE__ __int32_t; +#ifdef __UINT32_TYPE__ typedef __UINT32_TYPE__ __uint32_t; +#else +typedef unsigned __INT32_TYPE__ __uint32_t; +#endif #define ___int32_t_defined 1 #elif __EXP(INT_MAX) == 0x7fffffffL typedef signed int __int32_t; @@ -75,7 +87,11 @@ typedef unsigned char __uint32_t; #ifdef __INT64_TYPE__ typedef __INT64_TYPE__ __int64_t; +#ifdef __UINT64_TYPE__ typedef __UINT64_TYPE__ __uint64_t; +#else +typedef unsigned __INT64_TYPE__ __uint64_t; +#endif #define ___int64_t_defined 1 #elif __EXP(LONG_MAX) > 0x7fffffff typedef signed long __int64_t; @@ -102,7 +118,11 @@ typedef unsigned int __uint64_t; #ifdef __INT_LEAST8_TYPE__ typedef __INT_LEAST8_TYPE__ __int_least8_t; +#ifdef __UINT_LEAST8_TYPE__ typedef __UINT_LEAST8_TYPE__ __uint_least8_t; +#else +typedef unsigned __INT_LEAST8_TYPE__ __uint_least8_t; +#endif #define ___int_least8_t_defined 1 #elif defined(___int8_t_defined) typedef __int8_t __int_least8_t; @@ -124,7 +144,11 @@ typedef __uint64_t __uint_least8_t; #ifdef __INT_LEAST16_TYPE__ typedef __INT_LEAST16_TYPE__ __int_least16_t; +#ifdef __UINT_LEAST16_TYPE__ typedef __UINT_LEAST16_TYPE__ __uint_least16_t; +#else +typedef unsigned __INT_LEAST16_TYPE__ __uint_least16_t; +#endif #define ___int_least16_t_defined 1 #elif defined(___int16_t_defined) typedef __int16_t __int_least16_t; @@ -142,7 +166,11 @@ typedef __uint64_t __uint_least16_t; #ifdef __INT_LEAST32_TYPE__ typedef __INT_LEAST32_TYPE__ __int_least32_t; +#ifdef __UINT_LEAST32_TYPE__ typedef __UINT_LEAST32_TYPE__ __uint_least32_t; +#else +typedef unsigned __INT_LEAST32_TYPE__ __uint_least32_t; +#endif #define ___int_least32_t_defined 1 #elif defined(___int32_t_defined) typedef __int32_t __int_least32_t; @@ -156,7 +184,11 @@ typedef __uint64_t __uint_least32_t; #ifdef __INT_LEAST64_TYPE__ typedef __INT_LEAST64_TYPE__ __int_least64_t; +#ifdef __UINT_LEAST64_TYPE__ typedef __UINT_LEAST64_TYPE__ __uint_least64_t; +#else +typedef unsigned __INT_LEAST64_TYPE__ __uint_least64_t; +#endif #define ___int_least64_t_defined 1 #elif defined(___int64_t_defined) typedef __int64_t __int_least64_t; @@ -166,7 +198,11 @@ typedef __uint64_t __uint_least64_t; #ifdef __INTPTR_TYPE__ typedef __INTPTR_TYPE__ __intptr_t; +#ifdef __UINTPTR_TYPE__ typedef __UINTPTR_TYPE__ __uintptr_t; +#else +typedef unsigned __INTPTR_TYPE__ __uintptr_t; +#endif #elif defined(__PTRDIFF_TYPE__) typedef __PTRDIFF_TYPE__ __intptr_t; typedef unsigned __PTRDIFF_TYPE__ __uintptr_t; -- cgit v1.1