aboutsummaryrefslogtreecommitdiffstats
path: root/include/bits/types.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-10-16 22:25:28 +0200
committerMattias Andrée <maandree@operamail.com>2015-10-16 22:25:28 +0200
commitc5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde (patch)
tree81a07d8a2494fcf0bd430fa74716dd85b766bc2d /include/bits/types.h
parentupdate todo (diff)
downloadslibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.gz
slibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.bz2
slibc-c5b0889ccb64e6fc8aaa7c70bff8c30efb4efdde.tar.xz
the compiler determines how wchar is implement + intconf.h contains the signess of char
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'include/bits/types.h')
-rw-r--r--include/bits/types.h20
1 files changed, 18 insertions, 2 deletions
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