[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8...
authorTom Honermann <tom@honermann.net>
Wed, 25 Jan 2023 22:57:15 +0000 (17:57 -0500)
committerTom Honermann <tom@honermann.net>
Thu, 2 Feb 2023 18:31:19 +0000 (13:31 -0500)
commitcf93a3dd512e4912181f05790992c760378c8893
treef3a74907d2c0bda982b348e92a91c2ca5f3a1514
parent2fce90938bb51c5cd091aa3e6383066f96d3a583
[libc++] Remove use of internal glibc macros to determine if c8rtomb() and mbrtoc8() are present.

When support for declaring the c8rtomb() and mbrtoc8() functions within the
std namespace was added in commit 7e7013c5d4b1b3996c8dba668c5a94bb33b2999b,
internal glibc macros were used to determine if C2X extensions are enabled.
Specifically, a check for whether `__GLIBC_USE` is defined and whether
`__GLIBC_USE(ISOC2X)` is non-0 was added. `__GLIBC_USE` is an internal
detail of the glibc implementation that may be changed or removed in the
future potentially leading to inconsistency or compilation failures.  This
change removes the use of the internal glibc macro to avoid such problems.
Unfortunately, without another mechanism to determine if C2X extensions are
enabled, this removal will result in inconsistent declarations of the
c8rtomb() and mbrtoc8() functions; when C++ char8_t support is not enabled, but
C2X extensions are, these functions will be declared in the global namespace
but not in the std namespace. This situation will improve when C23 support
is finalized and the check can be re-implemented using `__STDC_VERSION__`.
libcxx/include/__config
libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp