From c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Fri, 16 Oct 2015 22:25:28 +0200 Subject: the compiler determines how wchar is implement + intconf.h contains the signess of char MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- include/bits/types.h | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'include/bits') diff --git a/include/bits/types.h b/include/bits/types.h index dfaef5d..f2318c1 100644 --- a/include/bits/types.h +++ b/include/bits/types.h @@ -94,11 +94,27 @@ typedef unsigned __LIMITED_PTR_INT uptrdiff_t; */ # if defined(__NEED_wchar_t) && !defined(__DEFINED_wchar_t) # define __DEFINED_wchar_t -typedef long int wchar_t +# if __WCHAR_BIT == 8 +typedef __WCHAR_SIGNESS __INT8 wchar_t +# elif __WCHAR_BIT == 16 +typedef __WCHAR_SIGNESS __INT16 wchar_t +# elif __WCHAR_BIT == 32 +typedef __WCHAR_SIGNESS __INT32 wchar_t +# elif __WCHAR_BIT == 64 +typedef __WCHAR_SIGNESS __INT64 wchar_t +# endif __warning("'wchar_t' is not guaranteed to be defined as expected, use 'int32_t'."); # endif # ifndef __WCHAR_MAX -# define __WCHAR_MAX INTPTR_MAX +# if __WCHAR_BIT == 8 +# define __WCHAR_MAX INT8_MAX +# elif __WCHAR_BIT == 16 +# define __WCHAR_MAX INT16_MAX +# elif __WCHAR_BIT == 32 +# define __WCHAR_MAX INT32_MAX +# elif __WCHAR_BIT == 64 +# define __WCHAR_MAX INT64_MAX +# endif # endif -- cgit v1.2.3-70-g09d2