aboutsummaryrefslogtreecommitdiff
path: root/include/uchar.h
diff options
context:
space:
mode:
authorEd Schouten <ed@FreeBSD.org>2013-05-25 16:58:12 +0000
committerEd Schouten <ed@FreeBSD.org>2013-05-25 16:58:12 +0000
commit74b6b2bb9903e0b210d52e9e903aa28a594babe1 (patch)
treed7543b18f91b77824ad2ce6bec9030e0b3531164 /include/uchar.h
parentaf8e44c84ab9d4144964b049e554ad1c322d983f (diff)
downloadsrc-74b6b2bb9903e0b210d52e9e903aa28a594babe1.tar.gz
src-74b6b2bb9903e0b210d52e9e903aa28a594babe1.zip
Fix <uchar.h> in for C++11.
It turns out that in C++11, char16_t and char32_t are built-in types; language keywords. Just fix this by putting traditional _*_T_DECLARED blocks around the definitions. We'll just predefine these in <sys/_types.h>. This also opens up the possibility to define char16_t in other header files, if ever needed (e.g. if we would gain a <ctype.h> for char16_t/char32_t).
Notes
Notes: svn path=/head/; revision=250985
Diffstat (limited to 'include/uchar.h')
-rw-r--r--include/uchar.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/uchar.h b/include/uchar.h
index 34c919ff85d0..a3fd4fd0195e 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);