Skip to content

Commit e0ffb14

Browse files
vhscampossaturn691
authored andcommitted
Define _LIBCPP_HAS_C8RTOMB_MBRTOC8
LLVM libcxx does not define the `char8_t` related functions, instead delegating their definitions to the underlying C library. libcxx defines a macro called `_LIBCPP_HAS_C8RTOMB_MBRTOC8` when it infers that the underlying C library provides these functions. picolibc provides the `char8_t` related functions regardless of the C++ version used, but this support only landed after version 1.8.8 and, at the time of writing, has not made into any released version yet. This is a temporary fix and should be removed when a picolibc release includes the support for `char8_t` and its related functions. When it's time to implement a proper solution, one needs to create logic to detect the picolibc version and define the macro accordingly. The macros that govern picolibc version are in `picolibc.h`.
1 parent 3c0a6c4 commit e0ffb14

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

libcxx/include/__config

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -995,21 +995,8 @@ typedef __char32_t char32_t;
995995
// functions is gradually being added to existing C libraries. The conditions
996996
// below check for known C library versions and conditions under which these
997997
// functions are declared by the C library.
998-
//
999-
// GNU libc 2.36 and newer declare c8rtomb() and mbrtoc8() in C++ modes if
1000-
// __cpp_char8_t is defined or if C2X extensions are enabled. Determining
1001-
// the latter depends on internal GNU libc details that are not appropriate
1002-
// to depend on here, so any declarations present when __cpp_char8_t is not
1003-
// defined are ignored.
1004-
# if defined(_LIBCPP_GLIBC_PREREQ)
1005-
# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
1006-
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
1007-
# else
1008-
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
1009-
# endif
1010-
# else
1011-
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
1012-
# endif
998+
// For picolibc:
999+
#define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
10131000

10141001
// There are a handful of public standard library types that are intended to
10151002
// support CTAD but don't need any explicit deduction guides to do so. This

0 commit comments

Comments
 (0)