aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config.h.in
diff options
context:
space:
mode:
authorTom Honermann <tom@honermann.net>2022-01-17 14:56:33 +0000
committerJonathan Wakely <jwakely@redhat.com>2022-01-18 16:31:02 +0000
commit0e4e4b37d9944430d0553c283a41e9a29482ccee (patch)
tree672c48d4e073a81aa1d536d6661b3855c2f0bae4 /libstdc++-v3/config.h.in
parentd7f2a09e98520c4e4927f460ad96803b05a205b1 (diff)
downloadgcc-0e4e4b37d9944430d0553c283a41e9a29482ccee.zip
gcc-0e4e4b37d9944430d0553c283a41e9a29482ccee.tar.gz
gcc-0e4e4b37d9944430d0553c283a41e9a29482ccee.tar.bz2
libstdc++: Declare std::c8rtomb and std::mbrtoc8 if provided by the C library
This patch completes implementation of the C++20 proposal P0482R6 [1] by adding declarations of std::c8rtomb() and std::mbrtoc8() in <cuchar> if provided by the C library in <uchar.h>. This patch addresses feedback provided in response to a previous patch submission [2]. Autoconf changes determine if the C library declares c8rtomb and mbrtoc8 at global scope when uchar.h is included and compiled with either -fchar8_t or -std=c++20. New _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T and _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20 configuration macros reflect the probe results. The <cuchar> header declares these functions in the std namespace only if available and the _GLIBCXX_USE_CHAR8_T configuration macro is defined (by default it is defined if the C++20 __cpp_char8_t feature test macro is defined) Patches to glibc to implement c8rtomb and mbrtoc8 have been submitted [3]. New tests validate the presence of these declarations. The tests pass trivially if the C library does not provide these functions. Otherwise they ensure that the functions are declared when <cuchar> is included and either -fchar8_t or -std=c++20 is enabled. 1]: WG21 P0482R6 "char8_t: A type for UTF-8 characters and strings (Revision 6)" https://wg21.link/p0482r6 [2]: [PATCH] C++ P0482R6 char8_t: declare std::c8rtomb and std::mbrtoc8 if provided by the C library https://gcc.gnu.org/pipermail/libstdc++/2021-June/052685.html [3]: "C++20 P0482R6 and C2X N2653" [Patch 0/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135061.html [Patch 1/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135062.html [Patch 2/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135063.html [Patch 3/3]: https://sourceware.org/pipermail/libc-alpha/2022-January/135064.html libstdc++-v3/ChangeLog: * acinclude.m4: Define config macros if uchar.h provides c8rtomb() and mbrtoc8(). * config.h.in: Regenerate. * configure: Regenerate. * include/c_compatibility/uchar.h (c8rtomb, mbrtoc8): Define. * include/c_global/cuchar (c8rtomb, mbrtoc8): Likewise. * include/c_std/cuchar (c8rtomb, mbrtoc8): Likewise. * testsuite/21_strings/headers/cuchar/functions_std_cxx20.cc: New test. * testsuite/21_strings/headers/cuchar/functions_std_fchar8_t.cc: New test.
Diffstat (limited to 'libstdc++-v3/config.h.in')
-rw-r--r--libstdc++-v3/config.h.in8
1 files changed, 8 insertions, 0 deletions
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 168961a..235d256 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -1010,6 +1010,14 @@
/* Define if obsolescent tmpnam is available in <stdio.h>. */
#undef _GLIBCXX_USE_TMPNAM
+/* Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be imported
+ into namespace std in <cuchar> for C++20. */
+#undef _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_CXX20
+
+/* Define if c8rtomb and mbrtoc8 functions in <uchar.h> should be imported
+ into namespace std in <cuchar> for -fchar8_t. */
+#undef _GLIBCXX_USE_UCHAR_C8RTOMB_MBRTOC8_FCHAR8_T
+
/* Define if utime is available in <utime.h>. */
#undef _GLIBCXX_USE_UTIME