Date: Sat, 25 May 2013 16:58:12 +0000 (UTC) From: Ed Schouten <ed@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r250985 - in head: include sys/sys Message-ID: <201305251658.r4PGwChD011107@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: ed Date: Sat May 25 16:58:12 2013 New Revision: 250985 URL: http://svnweb.freebsd.org/changeset/base/250985 Log: 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). Modified: head/include/uchar.h head/sys/sys/_types.h Modified: head/include/uchar.h ============================================================================== --- head/include/uchar.h Sat May 25 15:36:15 2013 (r250984) +++ head/include/uchar.h Sat May 25 16:58:12 2013 (r250985) @@ -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); Modified: head/sys/sys/_types.h ============================================================================== --- head/sys/sys/_types.h Sat May 25 15:36:15 2013 (r250984) +++ head/sys/sys/_types.h Sat May 25 16:58:12 2013 (r250985) @@ -94,6 +94,11 @@ typedef __ct_rune_t __wint_t; /* wint_t 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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201305251658.r4PGwChD011107>