summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/uchar.h13
-rw-r--r--sys/sys/_types.h5
2 files changed, 15 insertions, 3 deletions
diff --git a/include/uchar.h b/include/uchar.h
index 34c919f..a3fd4fd 100644
--- a/include/uchar.h
+++ b/include/uchar.h
@@ -32,6 +32,16 @@
#include <sys/cdefs.h>
#include <sys/_types.h>
+#ifndef _CHAR16_T_DECLARED
+typedef __char16_t char16_t;
+#define _CHAR16_T_DECLARED
+#endif
+
+#ifndef _CHAR32_T_DECLARED
+typedef __char32_t char32_t;
+#define _CHAR32_T_DECLARED
+#endif
+
#ifndef _MBSTATE_T_DECLARED
typedef __mbstate_t mbstate_t;
#define _MBSTATE_T_DECLARED
@@ -42,9 +52,6 @@ typedef __size_t size_t;
#define _SIZE_T_DECLARED
#endif
-typedef __char16_t char16_t;
-typedef __char32_t char32_t;
-
__BEGIN_DECLS
size_t c16rtomb(char * __restrict, char16_t, mbstate_t * __restrict);
size_t c32rtomb(char * __restrict, char32_t, mbstate_t * __restrict);
diff --git a/sys/sys/_types.h b/sys/sys/_types.h
index e47749f..34d1edb 100644
--- a/sys/sys/_types.h
+++ b/sys/sys/_types.h
@@ -94,6 +94,11 @@ typedef __ct_rune_t __wint_t; /* wint_t (see above) */
typedef __uint_least16_t __char16_t;
typedef __uint_least32_t __char32_t;
#endif
+/* In C++11, char16_t and char32_t are built-in types. */
+#if defined(__cplusplus) && __cplusplus >= 201103L
+#define _CHAR16_T_DECLARED
+#define _CHAR32_T_DECLARED
+#endif
typedef __uint32_t __dev_t; /* device number */
OpenPOWER on IntegriCloud