diff options
Diffstat (limited to 'newlib/libc/include')
-rw-r--r-- | newlib/libc/include/stdint.h | 19 | ||||
-rw-r--r-- | newlib/libc/include/wchar.h | 2 |
2 files changed, 19 insertions, 2 deletions
diff --git a/newlib/libc/include/stdint.h b/newlib/libc/include/stdint.h index 643b9694e..77431c706 100644 --- a/newlib/libc/include/stdint.h +++ b/newlib/libc/include/stdint.h @@ -423,11 +423,26 @@ typedef __uintptr_t uintptr_t; #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__ +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) +#define WCHAR_MIN (0 + L'\0') +#else +#define WCHAR_MIN (-0x7fffffff - 1 + L'\0') +#endif +#endif + +/* This must match definition in <wchar.h> */ +#ifndef WCHAR_MAX #ifdef __WCHAR_MAX__ #define WCHAR_MAX __WCHAR_MAX__ +#elif defined(__WCHAR_UNSIGNED__) || (L'\0' - 1 > 0) +#define WCHAR_MAX (0xffffffffu + L'\0') +#else +#define WCHAR_MAX (0x7fffffff + L'\0') #endif -#ifdef __WCHAR_MIN__ -#define WCHAR_MIN __WCHAR_MIN__ #endif /* wint_t is unsigned int on almost all GCC targets. */ diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index cdc8571aa..4f9a60705 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -24,6 +24,7 @@ # define WEOF ((wint_t)-1) #endif +/* This must match definition in <stdint.h> */ #ifndef WCHAR_MIN #ifdef __WCHAR_MIN__ #define WCHAR_MIN __WCHAR_MIN__ @@ -34,6 +35,7 @@ #endif #endif +/* This must match definition in <stdint.h> */ #ifndef WCHAR_MAX #ifdef __WCHAR_MAX__ #define WCHAR_MAX __WCHAR_MAX__ |