* [v3 PATCH] Add C++11 <cuchar>
@ 2015-08-13 14:48 Ed Smith-Rowland
2015-08-13 16:56 ` Jonathan Wakely
0 siblings, 1 reply; 6+ messages in thread
From: Ed Smith-Rowland @ 2015-08-13 14:48 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 373 bytes --]
Greetings,
Now that most systems have uchar.h for conversion between char16_t* and
char32_t* to multibyte (analogue of wchar.h and cwchar) i think we
should check off this last little crumb of C++11.
I submitted this a while back but Jonathan suggested improvements and it
took me a hot minute to wade through autohell.
Built and tested clean on x86_64-linux.
OK?
[-- Attachment #2: CL_cuchar --]
[-- Type: text/plain, Size: 623 bytes --]
2015-08-13 Edward Smith-Rowland <3dw4rd@verizon.net>
Add C++11 header <cuchar>.
* acinclude.m4: Regenerate.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check for <uchar.h>.
* include/Makefile.am: Check for <uchar.h>.
* include/Makefile.in: Regenerate.
* include/c/cuchar: New.
* include/c_compatibility/uchar.h: New.
* include/c_global/cuchar: New.
* include/c_std/cuchar: New.
* include/precompiled/stdc++.h: Include <cuchar>.
* testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>.
* testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc:
Include <uchar.h>.
[-- Attachment #3: patch_cuchar_2 --]
[-- Type: text/plain, Size: 20911 bytes --]
Index: acinclude.m4
===================================================================
--- acinclude.m4 (revision 226808)
+++ acinclude.m4 (working copy)
@@ -1926,6 +1926,51 @@
])
dnl
+dnl Check for uchar.h and usability.
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_CUCHAR], [
+
+ # Test uchar.h.
+ AC_MSG_CHECKING([for ISO C11 support for <uchar.h> for C++11 <cuchar>])
+ AC_CHECK_HEADERS(uchar.h, ac_has_uchar_h=yes, ac_has_uchar_h=no)
+ AC_MSG_RESULT($ac_has_uchar_h)
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ AC_TRY_COMPILE([#include <uchar.h>
+ #ifdef __STDC_UTF_16__
+ long i = __STDC_UTF_16__;
+ #endif
+ #ifdef __STDC_UTF_32__
+ long j = __STDC_UTF_32__;
+ #endif
+ namespace test
+ {
+ using ::c16rtomb;
+ using ::c32rtomb;
+ using ::mbrtoc16;
+ using ::mbrtoc32;
+ }
+ ],
+ [], [ac_c11_uchar_cxx11=yes], [ac_c11_uchar_cxx11=no])
+ else
+ ac_c11_uchar_cxx11=no
+ fi
+ AC_MSG_RESULT($ac_c11_uchar_cxx11)
+ if test x"$ac_c11_uchar_cxx11" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C11_UCHAR_CXX11, 1,
+ [Define if C11 functions in <uchar.h> should be imported in
+ <cuchar> in namespace std.])
+ fi
+
+ AC_LANG_RESTORE
+ AC_MSG_RESULT($enable_libstdcxx_cuchar)
+ GLIBCXX_CONDITIONAL(ENABLE_CUCHAR, test $enable_libstdcxx_cuchar = yes)
+])
+
+dnl
dnl Check for what type of C headers to use.
dnl
dnl --enable-cheaders= [does stuff].
Index: config.h.in
===================================================================
--- config.h.in (revision 226808)
+++ config.h.in (working copy)
@@ -454,6 +454,9 @@
/* Define to 1 if the target supports thread-local storage. */
#undef HAVE_TLS
+/* Define to 1 if you have the <uchar.h> header file. */
+#undef HAVE_UCHAR_H
+
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -780,6 +783,10 @@
/* Define to use Sun versioning in the shared library. */
#undef _GLIBCXX_SYMVER_SUN
+/* Define if C11 functions in <uchar.h> should be imported in <cuchar> in
+ namespace std. */
+#undef _GLIBCXX_USE_C11_UCHAR_CXX11
+
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> can be used or exposed. */
#undef _GLIBCXX_USE_C99
Index: configure
===================================================================
--- configure (revision 226808)
+++ configure (working copy)
@@ -671,6 +671,8 @@
OPT_LDFLAGS
SECTION_LDFLAGS
GLIBCXX_LIBS
+ENABLE_CUCHAR_FALSE
+ENABLE_CUCHAR_TRUE
ENABLE_VTABLE_VERIFY_FALSE
ENABLE_VTABLE_VERIFY_TRUE
VTV_CYGMIN_FALSE
@@ -11594,7 +11596,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11597 "configure"
+#line 11599 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11700,7 +11702,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11703 "configure"
+#line 11705 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15386,7 +15388,7 @@
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15389 "configure"
+#line 15391 "configure"
int main()
{
typedef bool atomic_type;
@@ -15421,7 +15423,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15424 "configure"
+#line 15426 "configure"
int main()
{
typedef short atomic_type;
@@ -15456,7 +15458,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15459 "configure"
+#line 15461 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15492,7 +15494,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15495 "configure"
+#line 15497 "configure"
int main()
{
typedef long long atomic_type;
@@ -15571,7 +15573,7 @@
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15574 "configure"
+#line 15576 "configure"
int main()
{
_Decimal32 d1;
@@ -15613,7 +15615,7 @@
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15616 "configure"
+#line 15618 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15647,7 +15649,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15650 "configure"
+#line 15652 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -18144,6 +18146,103 @@
+# Check for uchar.h and usability of routines.
+for ac_header in uchar.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "uchar.h" "ac_cv_header_uchar_h" "$ac_includes_default"
+if test "x$ac_cv_header_uchar_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UCHAR_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ # Test uchar.h.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C11 support for <uchar.h> for C++11 <cuchar>" >&5
+$as_echo_n "checking for ISO C11 support for <uchar.h> for C++11 <cuchar>... " >&6; }
+ for ac_header in uchar.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "uchar.h" "ac_cv_header_uchar_h" "$ac_includes_default"
+if test "x$ac_cv_header_uchar_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UCHAR_H 1
+_ACEOF
+ ac_has_uchar_h=yes
+else
+ ac_has_uchar_h=no
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_uchar_h" >&5
+$as_echo "$ac_has_uchar_h" >&6; }
+
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <uchar.h>
+ #ifdef __STDC_UTF_16__
+ long i = __STDC_UTF_16__;
+ #endif
+ #ifdef __STDC_UTF_32__
+ long j = __STDC_UTF_32__;
+ #endif
+ namespace test
+ {
+ using ::c16rtomb;
+ using ::c32rtomb;
+ using ::mbrtoc16;
+ using ::mbrtoc32;
+ }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_c11_uchar_cxx11=yes
+else
+ ac_c11_uchar_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ ac_c11_uchar_cxx11=no
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_c11_uchar_cxx11" >&5
+$as_echo "$ac_c11_uchar_cxx11" >&6; }
+ if test x"$ac_c11_uchar_cxx11" = x"yes"; then
+
+$as_echo "#define _GLIBCXX_USE_C11_UCHAR_CXX11 1" >>confdefs.h
+
+ fi
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libstdcxx_cuchar" >&5
+$as_echo "$enable_libstdcxx_cuchar" >&6; }
+
+
+
# For the streamoff typedef.
@@ -20750,7 +20849,7 @@
for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
-sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
+sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h uchar.h unistd.h \
wchar.h wctype.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -79826,6 +79925,15 @@
fi
+ if test $enable_libstdcxx_cuchar = yes; then
+ ENABLE_CUCHAR_TRUE=
+ ENABLE_CUCHAR_FALSE='#'
+else
+ ENABLE_CUCHAR_TRUE='#'
+ ENABLE_CUCHAR_FALSE=
+fi
+
+
if test $enable_symvers != no; then
ENABLE_SYMVERS_TRUE=
ENABLE_SYMVERS_FALSE='#'
@@ -80304,6 +80412,10 @@
as_fn_error "conditional \"ENABLE_VTABLE_VERIFY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_CUCHAR_TRUE}" && test -z "${ENABLE_CUCHAR_FALSE}"; then
+ as_fn_error "conditional \"ENABLE_CUCHAR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ENABLE_SYMVERS_TRUE}" && test -z "${ENABLE_SYMVERS_FALSE}"; then
as_fn_error "conditional \"ENABLE_SYMVERS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Index: configure.ac
===================================================================
--- configure.ac (revision 226808)
+++ configure.ac (working copy)
@@ -182,6 +182,10 @@
GLIBCXX_CHECK_STDIO_PROTO
GLIBCXX_CHECK_SYSTEM_ERROR
+# Check for uchar.h and usability of routines.
+AC_CHECK_HEADERS([uchar.h])
+GLIBCXX_ENABLE_CUCHAR
+
# For the streamoff typedef.
GLIBCXX_CHECK_INT64_T
@@ -234,7 +238,7 @@
AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
-sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
+sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h uchar.h unistd.h \
wchar.h wctype.h])
# Only do link tests if native. Else, hardcode.
Index: include/Makefile.am
===================================================================
--- include/Makefile.am (revision 226808)
+++ include/Makefile.am (working copy)
@@ -709,6 +709,7 @@
${c_base_srcdir}/cstring \
${c_base_srcdir}/ctgmath \
${c_base_srcdir}/ctime \
+ ${c_base_srcdir}/cuchar \
${c_base_srcdir}/cwchar \
${c_base_srcdir}/cwctype
@@ -751,10 +752,19 @@
${c_compatibility_srcdir}/string.h \
${c_compatibility_srcdir}/tgmath.h \
${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_srcdir}/uchar.h \
${c_compatibility_srcdir}/wchar.h \
${c_compatibility_srcdir}/wctype.h
endif
+if ENABLE_CUCHAR
+cuchar_headers = \
+ ${c_base_srcdir}/cuchar \
+ ${c_compatibility_srcdir}/uchar.h
+else
+cuchar_headers =
+endif
+
# Debug mode headers
debug_srcdir = ${glibcxx_srcdir}/include/debug
debug_builddir = ./debug
Index: include/Makefile.in
===================================================================
--- include/Makefile.in (revision 226808)
+++ include/Makefile.in (working copy)
@@ -996,6 +996,7 @@
${c_base_srcdir}/cstring \
${c_base_srcdir}/ctgmath \
${c_base_srcdir}/ctime \
+ ${c_base_srcdir}/cuchar \
${c_base_srcdir}/cwchar \
${c_base_srcdir}/cwctype
@@ -1032,10 +1033,16 @@
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/string.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/time.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/uchar.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wchar.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wctype.h
+@ENABLE_CUCHAR_FALSE@cuchar_headers =
+@ENABLE_CUCHAR_TRUE@cuchar_headers = \
+@ENABLE_CUCHAR_TRUE@ ${c_base_srcdir}/cuchar \
+@ENABLE_CUCHAR_TRUE@ ${c_compatibility_srcdir}/uchar.h
+
# Debug mode headers
debug_srcdir = ${glibcxx_srcdir}/include/debug
debug_builddir = ./debug
Index: include/c/cuchar
===================================================================
--- include/c/cuchar (revision 0)
+++ include/c/cuchar (working copy)
@@ -0,0 +1,47 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+# include_next <uchar.h>
+#endif
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/c_compatibility/uchar.h
===================================================================
--- include/c_compatibility/uchar.h (revision 0)
+++ include/c_compatibility/uchar.h (working copy)
@@ -0,0 +1,45 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file uchar.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cuchar>
+
+#ifndef _GLIBCXX_UCHAR_H
+#define _GLIBCXX_UCHAR_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+using std::mbrtoc16;
+using std::c16rtomb;
+using std::mbrtoc32;
+using std::c32rtomb;
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // _GLIBCXX_NAMESPACE_C
+
+#endif // _GLIBCXX_UCHAR_H
Index: include/c_global/cuchar
===================================================================
--- include/c_global/cuchar (revision 0)
+++ include/c_global/cuchar (working copy)
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c \#include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/c_std/cuchar
===================================================================
--- include/c_std/cuchar (revision 0)
+++ include/c_std/cuchar (working copy)
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2013 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/precompiled/stdc++.h
===================================================================
--- include/precompiled/stdc++.h (revision 226808)
+++ include/precompiled/stdc++.h (working copy)
@@ -56,6 +56,7 @@
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
+#include <cuchar>
#include <cwchar>
#include <cwctype>
#endif
Index: testsuite/17_intro/headers/c++200x/stdc++.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/stdc++.cc (revision 226808)
+++ testsuite/17_intro/headers/c++200x/stdc++.cc (working copy)
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
Index: testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc (revision 226808)
+++ testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc (working copy)
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
@@ -103,6 +106,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] Add C++11 <cuchar>
2015-08-13 14:48 [v3 PATCH] Add C++11 <cuchar> Ed Smith-Rowland
@ 2015-08-13 16:56 ` Jonathan Wakely
2015-08-14 15:46 ` Ed Smith-Rowland
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2015-08-13 16:56 UTC (permalink / raw)
To: Ed Smith-Rowland; +Cc: libstdc++, gcc-patches
On 13/08/15 10:37 -0400, Ed Smith-Rowland wrote:
>Greetings,
>
>Now that most systems have uchar.h for conversion between char16_t*
>and char32_t* to multibyte (analogue of wchar.h and cwchar) i think we
>should check off this last little crumb of C++11.
Ooh, I forgot about this, thanks!
> Add C++11 header <cuchar>.
> * acinclude.m4: Regenerate.
This file isn't auto-generated, so the changelog is wrong. Maybe
something like:
acinclude.m4 (GLIBCXX_ENABLE_CUCHAR): Define.
>Index: include/Makefile.am
>===================================================================
>--- include/Makefile.am (revision 226808)
>+++ include/Makefile.am (working copy)
>@@ -709,6 +709,7 @@
> ${c_base_srcdir}/cstring \
> ${c_base_srcdir}/ctgmath \
> ${c_base_srcdir}/ctime \
>+ ${c_base_srcdir}/cuchar \
> ${c_base_srcdir}/cwchar \
> ${c_base_srcdir}/cwctype
>
>@@ -751,10 +752,19 @@
> ${c_compatibility_srcdir}/string.h \
> ${c_compatibility_srcdir}/tgmath.h \
> ${c_compatibility_srcdir}/time.h \
>+ ${c_compatibility_srcdir}/uchar.h \
> ${c_compatibility_srcdir}/wchar.h \
> ${c_compatibility_srcdir}/wctype.h
> endif
>
>+if ENABLE_CUCHAR
>+cuchar_headers = \
>+ ${c_base_srcdir}/cuchar \
>+ ${c_compatibility_srcdir}/uchar.h
>+else
>+cuchar_headers =
>+endif
This cuchar_headers variable doesn't seem to be used anywhere, am I
missing something?
It looks like the headers are installed unconditionally, and this
ENABLE_CUCHAR block isn't needed (and so the GLIBCXX_CONDITIONAL that
creates it in acinclude.m4 isn't needed either).
>+// Copyright (C) 2013 Free Software Foundation, Inc.
A few of the new files have 2013 as the copyright date, not 2015
(I'm always forgetting to update the dates when I return to old
patches that have been uncommitted for a while!)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] Add C++11 <cuchar>
2015-08-13 16:56 ` Jonathan Wakely
@ 2015-08-14 15:46 ` Ed Smith-Rowland
2015-08-14 16:19 ` Ed Smith-Rowland
0 siblings, 1 reply; 6+ messages in thread
From: Ed Smith-Rowland @ 2015-08-14 15:46 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 2108 bytes --]
On 08/13/2015 10:51 AM, Jonathan Wakely wrote:
> On 13/08/15 10:37 -0400, Ed Smith-Rowland wrote:
>> Greetings,
>>
>> Now that most systems have uchar.h for conversion between char16_t*
>> and char32_t* to multibyte (analogue of wchar.h and cwchar) i think
>> we should check off this last little crumb of C++11.
>
> Ooh, I forgot about this, thanks!
>
>> Add C++11 header <cuchar>.
>> * acinclude.m4: Regenerate.
>
> This file isn't auto-generated, so the changelog is wrong. Maybe
> something like:
>
> acinclude.m4 (GLIBCXX_ENABLE_CUCHAR): Define.
>
Done.
>
>> Index: include/Makefile.am
>> ===================================================================
>> --- include/Makefile.am (revision 226808)
>> +++ include/Makefile.am (working copy)
>> @@ -709,6 +709,7 @@
>> ${c_base_srcdir}/cstring \
>> ${c_base_srcdir}/ctgmath \
>> ${c_base_srcdir}/ctime \
>> + ${c_base_srcdir}/cuchar \
>> ${c_base_srcdir}/cwchar \
>> ${c_base_srcdir}/cwctype
>>
>> @@ -751,10 +752,19 @@
>> ${c_compatibility_srcdir}/string.h \
>> ${c_compatibility_srcdir}/tgmath.h \
>> ${c_compatibility_srcdir}/time.h \
>> + ${c_compatibility_srcdir}/uchar.h \
>> ${c_compatibility_srcdir}/wchar.h \
>> ${c_compatibility_srcdir}/wctype.h
>> endif
>>
>> +if ENABLE_CUCHAR
>> +cuchar_headers = \
>> + ${c_base_srcdir}/cuchar \
>> + ${c_compatibility_srcdir}/uchar.h
>> +else
>> +cuchar_headers =
>> +endif
>
> This cuchar_headers variable doesn't seem to be used anywhere, am I
> missing something?
>
> It looks like the headers are installed unconditionally, and this
> ENABLE_CUCHAR block isn't needed (and so the GLIBCXX_CONDITIONAL that
> creates it in acinclude.m4 isn't needed either).
>
I really want to not install unconditionally. I fixed this too.
>
>> +// Copyright (C) 2013 Free Software Foundation, Inc.
>
> A few of the new files have 2013 as the copyright date, not 2015
> (I'm always forgetting to update the dates when I return to old
> patches that have been uncommitted for a while!)
>
>
LOL. Fixed.
Rebuilt retested on x86_64-linux. OK?
Ed
[-- Attachment #2: CL_cuchar --]
[-- Type: text/plain, Size: 643 bytes --]
2015-08-14 Edward Smith-Rowland <3dw4rd@verizon.net>
Add C++11 header <cuchar>.
* acinclude.m4 (GLIBCXX_ENABLE_CUCHAR): Define.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check for <uchar.h>.
* include/Makefile.am: Check for <uchar.h>.
* include/Makefile.in: Regenerate.
* include/c/cuchar: New.
* include/c_compatibility/uchar.h: New.
* include/c_global/cuchar: New.
* include/c_std/cuchar: New.
* include/precompiled/stdc++.h: Include <cuchar>.
* testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>.
* testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc:
Include <uchar.h>.
[-- Attachment #3: patch_cuchar_3 --]
[-- Type: text/plain, Size: 21024 bytes --]
Index: acinclude.m4
===================================================================
--- acinclude.m4 (revision 226866)
+++ acinclude.m4 (working copy)
@@ -1926,6 +1926,51 @@
])
dnl
+dnl Check for uchar.h and usability.
+dnl
+AC_DEFUN([GLIBCXX_ENABLE_CUCHAR], [
+
+ # Test uchar.h.
+ AC_MSG_CHECKING([for ISO C11 support for <uchar.h> for C++11 <cuchar>])
+ AC_CHECK_HEADERS(uchar.h, ac_has_uchar_h=yes, ac_has_uchar_h=no)
+ AC_MSG_RESULT($ac_has_uchar_h)
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ AC_TRY_COMPILE([#include <uchar.h>
+ #ifdef __STDC_UTF_16__
+ long i = __STDC_UTF_16__;
+ #endif
+ #ifdef __STDC_UTF_32__
+ long j = __STDC_UTF_32__;
+ #endif
+ namespace test
+ {
+ using ::c16rtomb;
+ using ::c32rtomb;
+ using ::mbrtoc16;
+ using ::mbrtoc32;
+ }
+ ],
+ [], [ac_c11_uchar_cxx11=yes], [ac_c11_uchar_cxx11=no])
+ else
+ ac_c11_uchar_cxx11=no
+ fi
+ AC_MSG_RESULT($ac_c11_uchar_cxx11)
+ if test x"$ac_c11_uchar_cxx11" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C11_UCHAR_CXX11, 1,
+ [Define if C11 functions in <uchar.h> should be imported in
+ <cuchar> in namespace std.])
+ fi
+
+ AC_LANG_RESTORE
+ AC_MSG_RESULT($enable_libstdcxx_cuchar)
+ GLIBCXX_CONDITIONAL(ENABLE_CUCHAR, test $enable_libstdcxx_cuchar = yes)
+])
+
+dnl
dnl Check for what type of C headers to use.
dnl
dnl --enable-cheaders= [does stuff].
Index: config.h.in
===================================================================
--- config.h.in (revision 226866)
+++ config.h.in (working copy)
@@ -454,6 +454,9 @@
/* Define to 1 if the target supports thread-local storage. */
#undef HAVE_TLS
+/* Define to 1 if you have the <uchar.h> header file. */
+#undef HAVE_UCHAR_H
+
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
@@ -780,6 +783,10 @@
/* Define to use Sun versioning in the shared library. */
#undef _GLIBCXX_SYMVER_SUN
+/* Define if C11 functions in <uchar.h> should be imported in <cuchar> in
+ namespace std. */
+#undef _GLIBCXX_USE_C11_UCHAR_CXX11
+
/* Define if C99 functions or macros from <wchar.h>, <math.h>, <complex.h>,
<stdio.h>, and <stdlib.h> can be used or exposed. */
#undef _GLIBCXX_USE_C99
Index: configure
===================================================================
--- configure (revision 226866)
+++ configure (working copy)
@@ -671,6 +671,8 @@
OPT_LDFLAGS
SECTION_LDFLAGS
GLIBCXX_LIBS
+ENABLE_CUCHAR_FALSE
+ENABLE_CUCHAR_TRUE
ENABLE_VTABLE_VERIFY_FALSE
ENABLE_VTABLE_VERIFY_TRUE
VTV_CYGMIN_FALSE
@@ -11594,7 +11596,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11597 "configure"
+#line 11599 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11700,7 +11702,7 @@
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11703 "configure"
+#line 11705 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -15386,7 +15388,7 @@
# Fake what AC_TRY_COMPILE does.
cat > conftest.$ac_ext << EOF
-#line 15389 "configure"
+#line 15391 "configure"
int main()
{
typedef bool atomic_type;
@@ -15421,7 +15423,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15424 "configure"
+#line 15426 "configure"
int main()
{
typedef short atomic_type;
@@ -15456,7 +15458,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15459 "configure"
+#line 15461 "configure"
int main()
{
// NB: _Atomic_word not necessarily int.
@@ -15492,7 +15494,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15495 "configure"
+#line 15497 "configure"
int main()
{
typedef long long atomic_type;
@@ -15571,7 +15573,7 @@
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15574 "configure"
+#line 15576 "configure"
int main()
{
_Decimal32 d1;
@@ -15613,7 +15615,7 @@
# unnecessary for this test.
cat > conftest.$ac_ext << EOF
-#line 15616 "configure"
+#line 15618 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -15647,7 +15649,7 @@
rm -f conftest*
cat > conftest.$ac_ext << EOF
-#line 15650 "configure"
+#line 15652 "configure"
template<typename T1, typename T2>
struct same
{ typedef T2 type; };
@@ -18149,6 +18151,103 @@
+# Check for uchar.h and usability of routines.
+for ac_header in uchar.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "uchar.h" "ac_cv_header_uchar_h" "$ac_includes_default"
+if test "x$ac_cv_header_uchar_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UCHAR_H 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ # Test uchar.h.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ISO C11 support for <uchar.h> for C++11 <cuchar>" >&5
+$as_echo_n "checking for ISO C11 support for <uchar.h> for C++11 <cuchar>... " >&6; }
+ for ac_header in uchar.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "uchar.h" "ac_cv_header_uchar_h" "$ac_includes_default"
+if test "x$ac_cv_header_uchar_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_UCHAR_H 1
+_ACEOF
+ ac_has_uchar_h=yes
+else
+ ac_has_uchar_h=no
+fi
+
+done
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_has_uchar_h" >&5
+$as_echo "$ac_has_uchar_h" >&6; }
+
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <uchar.h>
+ #ifdef __STDC_UTF_16__
+ long i = __STDC_UTF_16__;
+ #endif
+ #ifdef __STDC_UTF_32__
+ long j = __STDC_UTF_32__;
+ #endif
+ namespace test
+ {
+ using ::c16rtomb;
+ using ::c32rtomb;
+ using ::mbrtoc16;
+ using ::mbrtoc32;
+ }
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_c11_uchar_cxx11=yes
+else
+ ac_c11_uchar_cxx11=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ ac_c11_uchar_cxx11=no
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_c11_uchar_cxx11" >&5
+$as_echo "$ac_c11_uchar_cxx11" >&6; }
+ if test x"$ac_c11_uchar_cxx11" = x"yes"; then
+
+$as_echo "#define _GLIBCXX_USE_C11_UCHAR_CXX11 1" >>confdefs.h
+
+ fi
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_libstdcxx_cuchar" >&5
+$as_echo "$enable_libstdcxx_cuchar" >&6; }
+
+
+
# For the streamoff typedef.
@@ -20755,7 +20854,7 @@
for ac_header in endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
-sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
+sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h uchar.h unistd.h \
wchar.h wctype.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
@@ -79831,6 +79930,15 @@
fi
+ if test $enable_libstdcxx_cuchar = yes; then
+ ENABLE_CUCHAR_TRUE=
+ ENABLE_CUCHAR_FALSE='#'
+else
+ ENABLE_CUCHAR_TRUE='#'
+ ENABLE_CUCHAR_FALSE=
+fi
+
+
if test $enable_symvers != no; then
ENABLE_SYMVERS_TRUE=
ENABLE_SYMVERS_FALSE='#'
@@ -80309,6 +80417,10 @@
as_fn_error "conditional \"ENABLE_VTABLE_VERIFY\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+if test -z "${ENABLE_CUCHAR_TRUE}" && test -z "${ENABLE_CUCHAR_FALSE}"; then
+ as_fn_error "conditional \"ENABLE_CUCHAR\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
if test -z "${ENABLE_SYMVERS_TRUE}" && test -z "${ENABLE_SYMVERS_FALSE}"; then
as_fn_error "conditional \"ENABLE_SYMVERS\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
Index: configure.ac
===================================================================
--- configure.ac (revision 226866)
+++ configure.ac (working copy)
@@ -182,6 +182,10 @@
GLIBCXX_CHECK_STDIO_PROTO
GLIBCXX_CHECK_SYSTEM_ERROR
+# Check for uchar.h and usability of routines.
+AC_CHECK_HEADERS([uchar.h])
+GLIBCXX_ENABLE_CUCHAR
+
# For the streamoff typedef.
GLIBCXX_CHECK_INT64_T
@@ -234,7 +238,7 @@
AC_CHECK_HEADERS([endian.h execinfo.h float.h fp.h ieeefp.h inttypes.h \
locale.h machine/endian.h machine/param.h nan.h stdint.h stdlib.h string.h \
strings.h sys/ipc.h sys/isa_defs.h sys/machine.h sys/param.h \
-sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h unistd.h \
+sys/resource.h sys/sem.h sys/stat.h sys/time.h sys/types.h uchar.h unistd.h \
wchar.h wctype.h])
# Only do link tests if native. Else, hardcode.
Index: include/Makefile.am
===================================================================
--- include/Makefile.am (revision 226866)
+++ include/Makefile.am (working copy)
@@ -710,6 +710,7 @@
${c_base_srcdir}/cstring \
${c_base_srcdir}/ctgmath \
${c_base_srcdir}/ctime \
+ ${c_base_cuchar_header} \
${c_base_srcdir}/cwchar \
${c_base_srcdir}/cwctype
@@ -752,10 +753,19 @@
${c_compatibility_srcdir}/string.h \
${c_compatibility_srcdir}/tgmath.h \
${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_cuchar_header} \
${c_compatibility_srcdir}/wchar.h \
${c_compatibility_srcdir}/wctype.h
endif
+if ENABLE_CUCHAR
+c_base_cuchar_header = ${c_base_srcdir}/cuchar
+c_compatibility_cuchar_header = ${c_compatibility_srcdir}/uchar.h
+else
+c_base_cuchar_header =
+c_compatibility_cuchar_header =
+endif
+
# Debug mode headers
debug_srcdir = ${glibcxx_srcdir}/include/debug
debug_builddir = ./debug
Index: include/Makefile.in
===================================================================
--- include/Makefile.in (revision 226866)
+++ include/Makefile.in (working copy)
@@ -997,6 +997,7 @@
${c_base_srcdir}/cstring \
${c_base_srcdir}/ctgmath \
${c_base_srcdir}/ctime \
+ ${c_base_cuchar_header} \
${c_base_srcdir}/cwchar \
${c_base_srcdir}/cwctype
@@ -1033,9 +1034,14 @@
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/string.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/tgmath.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/time.h \
+@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_cuchar_header} \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wchar.h \
@GLIBCXX_C_HEADERS_C_TRUE@ ${c_compatibility_srcdir}/wctype.h
+@ENABLE_CUCHAR_FALSE@c_base_cuchar_header =
+@ENABLE_CUCHAR_TRUE@c_base_cuchar_header = ${c_base_srcdir}/cuchar
+@ENABLE_CUCHAR_FALSE@c_compatibility_cuchar_header =
+@ENABLE_CUCHAR_TRUE@c_compatibility_cuchar_header = ${c_compatibility_srcdir}/uchar.h
# Debug mode headers
debug_srcdir = ${glibcxx_srcdir}/include/debug
Index: include/c/cuchar
===================================================================
--- include/c/cuchar (revision 0)
+++ include/c/cuchar (working copy)
@@ -0,0 +1,47 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+# include_next <uchar.h>
+#endif
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/c_compatibility/uchar.h
===================================================================
--- include/c_compatibility/uchar.h (revision 0)
+++ include/c_compatibility/uchar.h (working copy)
@@ -0,0 +1,45 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file uchar.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cuchar>
+
+#ifndef _GLIBCXX_UCHAR_H
+#define _GLIBCXX_UCHAR_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+using std::mbrtoc16;
+using std::c16rtomb;
+using std::mbrtoc32;
+using std::c32rtomb;
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // _GLIBCXX_NAMESPACE_C
+
+#endif // _GLIBCXX_UCHAR_H
Index: include/c_global/cuchar
===================================================================
--- include/c_global/cuchar (revision 0)
+++ include/c_global/cuchar (working copy)
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c \#include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/c_std/cuchar
===================================================================
--- include/c_std/cuchar (revision 0)
+++ include/c_std/cuchar (working copy)
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882: 21.4
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
Index: include/precompiled/stdc++.h
===================================================================
--- include/precompiled/stdc++.h (revision 226866)
+++ include/precompiled/stdc++.h (working copy)
@@ -56,6 +56,7 @@
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
+#include <cuchar>
#include <cwchar>
#include <cwctype>
#endif
Index: testsuite/17_intro/headers/c++200x/stdc++.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/stdc++.cc (revision 226866)
+++ testsuite/17_intro/headers/c++200x/stdc++.cc (working copy)
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
Index: testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc (revision 226866)
+++ testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc (working copy)
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
@@ -103,6 +106,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] Add C++11 <cuchar>
2015-08-14 15:46 ` Ed Smith-Rowland
@ 2015-08-14 16:19 ` Ed Smith-Rowland
2015-08-14 16:42 ` Jonathan Wakely
2015-09-04 11:18 ` Jonathan Wakely
0 siblings, 2 replies; 6+ messages in thread
From: Ed Smith-Rowland @ 2015-08-14 16:19 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc-patches
OK.
This tested clean because it didn't install the headers.
So Jonathan. I am going to throw in the sponge on the configury.
Could you have a look and carry this over the finish line?
Ed
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] Add C++11 <cuchar>
2015-08-14 16:19 ` Ed Smith-Rowland
@ 2015-08-14 16:42 ` Jonathan Wakely
2015-09-04 11:18 ` Jonathan Wakely
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2015-08-14 16:42 UTC (permalink / raw)
To: Ed Smith-Rowland; +Cc: Jonathan Wakely, libstdc++, gcc-patches
On 14 August 2015 at 17:01, Ed Smith-Rowland wrote:
> OK.
>
> This tested clean because it didn't install the headers.
>
> So Jonathan. I am going to throw in the sponge on the configury.
:-)
> Could you have a look and carry this over the finish line?
Will do, getting that stuff right is always a pain!
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3 PATCH] Add C++11 <cuchar>
2015-08-14 16:19 ` Ed Smith-Rowland
2015-08-14 16:42 ` Jonathan Wakely
@ 2015-09-04 11:18 ` Jonathan Wakely
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Wakely @ 2015-09-04 11:18 UTC (permalink / raw)
To: Ed Smith-Rowland; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 875 bytes --]
On 14/08/15 12:01 -0400, Ed Smith-Rowland wrote:
>OK.
>
>This tested clean because it didn't install the headers.
>
>So Jonathan. I am going to throw in the sponge on the configury.
>
>Could you have a look and carry this over the finish line?
The main problem was in acinclude.m4:
+ GLIBCXX_CONDITIONAL(ENABLE_CUCHAR, test $enable_libstdcxx_cuchar =
yes)
Nothing set enable_libstdcxx_cuchar, so the conditional was false, and
so the headers weren't installed due to:
+if ENABLE_CUCHAR
+c_base_cuchar_header = ${c_base_srcdir}/cuchar
+c_compatibility_cuchar_header = ${c_compatibility_srcdir}/uchar.h
+else
+c_base_cuchar_header =
+c_compatibility_cuchar_header =
+endif
I've attached what I'm committing, which has a few tweaks but is
substantially the same as your last patch. Thanks for adding this
missing feature!
Tested powerpc64le-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 13428 bytes --]
commit 7a0a6889a1e348c1bc3980e0417dc3b4fbf2192d
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Sep 4 11:27:08 2015 +0100
Add C++11 header <cuchar>.
2015-09-04 Edward Smith-Rowland <3dw4rd@verizon.net>
Jonathan Wakely <jwakely@redhat.com>
* acinclude.m4 (GLIBCXX_CHECK_UCHAR_H): Define.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Check for <uchar.h>.
* include/Makefile.am: Add new headers.
* include/Makefile.in: Regenerate.
* include/c/cuchar: New.
* include/c_compatibility/uchar.h: New.
* include/c_global/cuchar: New.
* include/c_std/cuchar: New.
* include/precompiled/stdc++.h: Include <cuchar>.
* testsuite/17_intro/headers/c++200x/stdc++.cc: Include <uchar.h>.
* testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc:
Include <uchar.h>.
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index 789bc58..64c9b7e 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -1809,6 +1809,52 @@ AC_DEFUN([GLIBCXX_CHECK_C99_TR1], [
])
dnl
+dnl Check for uchar.h and usability.
+dnl
+AC_DEFUN([GLIBCXX_CHECK_UCHAR_H], [
+
+ # Test uchar.h.
+ AC_CHECK_HEADERS(uchar.h, ac_has_uchar_h=yes, ac_has_uchar_h=no)
+
+ AC_LANG_SAVE
+ AC_LANG_CPLUSPLUS
+ ac_save_CXXFLAGS="$CXXFLAGS"
+ CXXFLAGS="$CXXFLAGS -std=c++11"
+
+ if test x"$ac_has_uchar_h" = x"yes"; then
+ AC_MSG_CHECKING([for ISO C11 support for <uchar.h>])
+ AC_TRY_COMPILE([#include <uchar.h>
+ #ifdef __STDC_UTF_16__
+ long i = __STDC_UTF_16__;
+ #endif
+ #ifdef __STDC_UTF_32__
+ long j = __STDC_UTF_32__;
+ #endif
+ namespace test
+ {
+ using ::c16rtomb;
+ using ::c32rtomb;
+ using ::mbrtoc16;
+ using ::mbrtoc32;
+ }
+ ],
+ [], [ac_c11_uchar_cxx11=yes], [ac_c11_uchar_cxx11=no])
+ else
+ ac_c11_uchar_cxx11=no
+ fi
+ AC_MSG_RESULT($ac_c11_uchar_cxx11)
+ if test x"$ac_c11_uchar_cxx11" = x"yes"; then
+ AC_DEFINE(_GLIBCXX_USE_C11_UCHAR_CXX11, 1,
+ [Define if C11 functions in <uchar.h> should be imported into
+ namespace std in <cuchar>.])
+ fi
+
+ CXXFLAGS="$ac_save_CXXFLAGS"
+ AC_LANG_RESTORE
+])
+
+
+dnl
dnl Check whether "/dev/random" and "/dev/urandom" are available for the
dnl random_device of "TR1" (Chapter 5.1, "Random number generation").
dnl
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 96ff16f..3456348 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -181,6 +181,7 @@ GLIBCXX_ENABLE_VTABLE_VERIFY([no])
# Checks for operating systems support that doesn't require linking.
GLIBCXX_CHECK_STDIO_PROTO
GLIBCXX_CHECK_SYSTEM_ERROR
+GLIBCXX_CHECK_UCHAR_H
# For the streamoff typedef.
GLIBCXX_CHECK_INT64_T
diff --git a/libstdc++-v3/include/Makefile.am b/libstdc++-v3/include/Makefile.am
index 41fc4af..e579b22 100644
--- a/libstdc++-v3/include/Makefile.am
+++ b/libstdc++-v3/include/Makefile.am
@@ -710,6 +710,7 @@ c_base_headers = \
${c_base_srcdir}/cstring \
${c_base_srcdir}/ctgmath \
${c_base_srcdir}/ctime \
+ ${c_base_srcdir}/cuchar \
${c_base_srcdir}/cwchar \
${c_base_srcdir}/cwctype
@@ -752,6 +753,7 @@ c_compatibility_headers = \
${c_compatibility_srcdir}/string.h \
${c_compatibility_srcdir}/tgmath.h \
${c_compatibility_srcdir}/time.h \
+ ${c_compatibility_srcdir}/uchar.h \
${c_compatibility_srcdir}/wchar.h \
${c_compatibility_srcdir}/wctype.h
endif
diff --git a/libstdc++-v3/include/c/cuchar b/libstdc++-v3/include/c/cuchar
new file mode 100644
index 0000000..dd50c47
--- /dev/null
+++ b/libstdc++-v3/include/c/cuchar
@@ -0,0 +1,47 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+//
+// ISO C++ 14882:2011 21.8
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+# include_next <uchar.h>
+#endif
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
diff --git a/libstdc++-v3/include/c_compatibility/uchar.h b/libstdc++-v3/include/c_compatibility/uchar.h
new file mode 100644
index 0000000..746f4af
--- /dev/null
+++ b/libstdc++-v3/include/c_compatibility/uchar.h
@@ -0,0 +1,45 @@
+// -*- C++ -*- compatibility header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file uchar.h
+ * This is a Standard C++ Library header.
+ */
+
+#include <cuchar>
+
+#ifndef _GLIBCXX_UCHAR_H
+#define _GLIBCXX_UCHAR_H 1
+
+#ifdef _GLIBCXX_NAMESPACE_C
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+using std::mbrtoc16;
+using std::c16rtomb;
+using std::mbrtoc32;
+using std::c32rtomb;
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // _GLIBCXX_NAMESPACE_C
+
+#endif // _GLIBCXX_UCHAR_H
diff --git a/libstdc++-v3/include/c_global/cuchar b/libstdc++-v3/include/c_global/cuchar
new file mode 100644
index 0000000..3b30c6a
--- /dev/null
+++ b/libstdc++-v3/include/c_global/cuchar
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c \#include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882:2011 21.8
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
diff --git a/libstdc++-v3/include/c_std/cuchar b/libstdc++-v3/include/c_std/cuchar
new file mode 100644
index 0000000..7d5eedb
--- /dev/null
+++ b/libstdc++-v3/include/c_std/cuchar
@@ -0,0 +1,77 @@
+// -*- C++ -*- forwarding header.
+
+// Copyright (C) 2015 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
+
+/** @file include/cuchar
+ * This is a Standard C++ Library file. You should @c #include this file
+ * in your programs, rather than any of the @a *.h implementation files.
+ *
+ * This is the C++ version of the Standard C Library header @c uchar.h,
+ * and its contents are (mostly) the same as that header, but are all
+ * contained in the namespace @c std (except for names which are defined
+ * as macros in C).
+ */
+
+//
+// ISO C++ 14882:2011 21.8
+//
+
+#ifndef _GLIBCXX_CUCHAR
+#define _GLIBCXX_CUCHAR 1
+
+#pragma GCC system_header
+
+#if __cplusplus < 201103L
+# include <bits/c++0x_warning.h>
+#else
+
+#include <bits/c++config.h>
+#include <cwchar>
+
+#if _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#include <uchar.h>
+
+// Get rid of those macros defined in <uchar.h> in lieu of real functions.
+#undef mbrtoc16
+#undef c16rtomb
+#undef mbrtoc32
+#undef c32rtomb
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ using ::mbrtoc16;
+ using ::c16rtomb;
+ using ::mbrtoc32;
+ using ::c32rtomb;
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace std
+
+#endif // _GLIBCXX_USE_C11_UCHAR_CXX11
+
+#endif // C++11
+
+#endif // _GLIBCXX_CUCHAR
diff --git a/libstdc++-v3/include/precompiled/stdc++.h b/libstdc++-v3/include/precompiled/stdc++.h
index 693391a..ab119fe 100644
--- a/libstdc++-v3/include/precompiled/stdc++.h
+++ b/libstdc++-v3/include/precompiled/stdc++.h
@@ -56,6 +56,7 @@
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
+#include <cuchar>
#include <cwchar>
#include <cwctype>
#endif
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
index 50c3274..d1c64b1 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++.cc
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
diff --git a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
index 9fa919f..e51bdee 100644
--- a/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
+++ b/libstdc++-v3/testsuite/17_intro/headers/c++200x/stdc++_multiple_inclusion.cc
@@ -59,6 +59,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
@@ -103,6 +106,9 @@
#include <tgmath.h>
#endif
#include <time.h>
+#if __has_include(<uchar.h>)
+#include <uchar.h>
+#endif
#ifdef _GLIBCXX_HAVE_WCHAR_H
#include <wchar.h>
#endif
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-09-04 11:13 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-13 14:48 [v3 PATCH] Add C++11 <cuchar> Ed Smith-Rowland
2015-08-13 16:56 ` Jonathan Wakely
2015-08-14 15:46 ` Ed Smith-Rowland
2015-08-14 16:19 ` Ed Smith-Rowland
2015-08-14 16:42 ` Jonathan Wakely
2015-09-04 11:18 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).