[libcxx-commits] [libcxx] [libcxx] Define _LIBCPP_HAS_C8RTOMB_MBRTOC8 for picolibc (PR #158648)

Victor Campos via libcxx-commits libcxx-commits at lists.llvm.org
Tue Sep 16 02:44:03 PDT 2025


https://github.com/vhscampos updated https://github.com/llvm/llvm-project/pull/158648

>From 488031a89be3e5b15a4c450ccb76199b8d1d80af Mon Sep 17 00:00:00 2001
From: Victor Campos <victor.campos at arm.com>
Date: Thu, 7 Aug 2025 16:03:44 +0100
Subject: [PATCH] [libcxx] Define _LIBCPP_HAS_C8RTOMB_MBRTOC8 for picolibc

Starting from picolibc 1.8.9, the `char8_t` related functions are
provided.

This patch adds logic to detect the underlying picolibc version and
define the `_LIBCPP_HAS_C8RTOMB_MBRTOC8 macro` accordingly.
---
 libcxx/include/__config                                       | 2 ++
 .../test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp  | 4 ++++
 libcxx/utils/libcxx/test/features.py                          | 1 +
 3 files changed, 7 insertions(+)

diff --git a/libcxx/include/__config b/libcxx/include/__config
index b4c081dcdff1b..45f6852e379a7 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1027,6 +1027,8 @@ typedef __char32_t char32_t;
 #    else
 #      define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
 #    endif
+#  elif defined(__clang__)
+#    define _LIBCPP_HAS_C8RTOMB_MBRTOC8 1
 #  else
 #    define _LIBCPP_HAS_C8RTOMB_MBRTOC8 0
 #  endif
diff --git a/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp b/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp
index 1d4a225668d80..0f59fbbf59b9e 100644
--- a/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp
+++ b/libcxx/test/std/strings/c.strings/no_c8rtomb_mbrtoc8.verify.cpp
@@ -7,6 +7,10 @@
 //===----------------------------------------------------------------------===//
 
 // UNSUPPORTED: c++03
+// XFAIL: aix
+// XFAIL: darwin
+// XFAIL: freebsd
+// XFAIL: windows
 
 #include <uchar.h>
 
diff --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index a964f3bdeeb46..d56816bfb2716 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -669,6 +669,7 @@ def _getLocaleFlagsAction(cfg, locale, alts, members):
             """,
         ),
     ),
+    Feature(name="aix", when=lambda cfg: "_AIX" in compilerMacros(cfg)),
 ]
 
 # Add features representing the build host platform name.



More information about the libcxx-commits mailing list