From c57ccec64901ac5b90b89ff10073dc4207d47766 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 12 May 2014 17:02:11 +0000 Subject: [PATCH] * libc/include/stdint.h (WCHAR_MIN): Copy definition from wchar.h. (WCHAR_MAX): Ditto. * libc/include/wchar.h (WCHAR_MIN): Add comment. (WCHAR_MAX): Ditto. --- newlib/ChangeLog | 7 +++++++ newlib/libc/include/stdint.h | 21 ++++++++++++++++++--- newlib/libc/include/wchar.h | 2 ++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 6d987969f..5d36cec88 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,10 @@ +2014-05-12 Corinna Vinschen + + * libc/include/stdint.h (WCHAR_MIN): Copy definition from wchar.h. + (WCHAR_MAX): Ditto. + * libc/include/wchar.h (WCHAR_MIN): Add comment. + (WCHAR_MAX): Ditto. + 2014-05-09 Corinna Vinschen * libc/include/stdio.h (tempnam): Declare as __BSD_VISIBLE or 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) -#ifdef __WCHAR_MAX__ -#define WCHAR_MAX __WCHAR_MAX__ -#endif +/* This must match definition in */ +#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 */ +#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 #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 */ #ifndef WCHAR_MIN #ifdef __WCHAR_MIN__ #define WCHAR_MIN __WCHAR_MIN__ @@ -34,6 +35,7 @@ #endif #endif +/* This must match definition in */ #ifndef WCHAR_MAX #ifdef __WCHAR_MAX__ #define WCHAR_MAX __WCHAR_MAX__