Skip to content
17 changes: 15 additions & 2 deletions libcxx/include/__config
Original file line number Diff line number Diff line change
Expand Up @@ -1021,14 +1021,27 @@ typedef __char32_t char32_t;
// the latter depends on internal GNU libc details that are not appropriate
// to depend on here, so any declarations present when __cpp_char8_t is not
// defined are ignored.
//
// picolibc 1.8.9 and newer declare the two functions unconditionally.
//
// Apple C library, Microsoft C Runtime, AIX C library and FreeBSD libc do not
// yet support these functions.
# if defined(_LIBCPP_GLIBC_PREREQ)
# if _LIBCPP_GLIBC_PREREQ(2, 36) && defined(__cpp_char8_t)
# if defined(__cpp_char8_t) && _LIBCPP_GLIBC_PREREQ(2, 36)
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
# else
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
# endif
# else
# elif defined(_LIBCPP_PICOLIBC_PREREQ)
# if _LIBCPP_PICOLIBC_PREREQ(1, 8, 9)
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
# else
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
# endif
# elif defined(__APPLE__) || defined(_MSC_VER) || defined(_LIBCPP_UCRT) || defined(_AIX) || defined(__FreeBSD__)
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
# else
# define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
# endif

// There are a handful of public standard library types that are intended to
Expand Down
11 changes: 11 additions & 0 deletions libcxx/include/__configuration/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@
// user code. Move code paths that need _NEWLIB_VERSION to another customization mechanism.
#if __has_include(<picolibc.h>)
# include <picolibc.h>
# define _LIBCPP_PICOLIBC_VERSION_INT(maj, min, patch) (maj * 10000 + min * 100 + patch)
# define _LIBCPP_PICOLIBC_PREREQ(maj, min, patch) \
_LIBCPP_PICOLIBC_VERSION_INT(__PICOLIBC__, __PICOLIBC_MINOR__, __PICOLIBC_PATCHLEVEL__) >= \
_LIBCPP_PICOLIBC_VERSION_INT(maj, min, patch)
#endif

#if __has_include(<corecrt.h>)
# include <corecrt.h>
# if defined(_UCRT)
# define _LIBCPP_UCRT
# endif
#endif

#ifndef __BYTE_ORDER__
Expand Down
Loading