[all-commits] [llvm/llvm-project] cf93a3: [libc++] Remove use of internal glibc macros to de...

Tom Honermann via All-commits all-commits at lists.llvm.org
Thu Feb 2 10:31:46 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cf93a3dd512e4912181f05790992c760378c8893
      https://github.com/llvm/llvm-project/commit/cf93a3dd512e4912181f05790992c760378c8893
  Author: Tom Honermann <tom at honermann.net>
  Date:   2023-02-02 (Thu, 02 Feb 2023)

  Changed paths:
    M libcxx/include/__config
    M libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp

  Log Message:
  -----------
  [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__`.




More information about the All-commits mailing list