[libcxx-commits] [libcxx] [AIX][libc++] Fix redefinition of wchar_t overloads on AIX (PR #201432)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 3 12:05:38 PDT 2026


https://github.com/Himadhith updated https://github.com/llvm/llvm-project/pull/201432

>From 499f6a0e2614218ee6b581b348d69c742eea8e9f Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Wed, 3 Jun 2026 14:48:19 -0400
Subject: [PATCH] [AIX][libc++] Fix redefinition of wchar_t overloads on AIX

---
 libcxx/include/wchar.h                                    | 6 ++++--
 libcxx/test/extensions/clang/clang_modules_include.gen.py | 2 --
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h
index a932dd266b862..3f07106238d1d 100644
--- a/libcxx/include/wchar.h
+++ b/libcxx/include/wchar.h
@@ -137,6 +137,7 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS
 #      if defined(__cplusplus) && !defined(_LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS) && defined(_LIBCPP_PREFERRED_OVERLOAD)
+#        if defined(_AIX) && !defined(_LIBCPP_WCHAR_H_OVERLOADS)
 extern "C++" {
 inline _LIBCPP_HIDE_FROM_ABI wchar_t* __libcpp_wcschr(const wchar_t* __s, wchar_t __c) {
   return (wchar_t*)wcschr(__s, __c);
@@ -191,15 +192,16 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD wchar_t* wmemchr(wchar_t
   return __libcpp_wmemchr(__s, __c, __n);
 }
 }
-#      endif
+#        endif
 
-#      if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
+#        if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT_LIKE) || defined(__MVS__))
 extern "C" {
 size_t mbsnrtowcs(
     wchar_t* __restrict __dst, const char** __restrict __src, size_t __nmc, size_t __len, mbstate_t* __restrict __ps);
 size_t wcsnrtombs(
     char* __restrict __dst, const wchar_t** __restrict __src, size_t __nwc, size_t __len, mbstate_t* __restrict __ps);
 } // extern "C"
+#        endif // _LIBCPP_WCHAR_H_OVERLOADS
 #      endif // __cplusplus && (_LIBCPP_MSVCRT || __MVS__)
 #    endif   // _LIBCPP_HAS_WIDE_CHARACTERS
 #  endif     // _LIBCPP_WCHAR_H
diff --git a/libcxx/test/extensions/clang/clang_modules_include.gen.py b/libcxx/test/extensions/clang/clang_modules_include.gen.py
index 28661049d6e85..f0de60bacd7a7 100644
--- a/libcxx/test/extensions/clang/clang_modules_include.gen.py
+++ b/libcxx/test/extensions/clang/clang_modules_include.gen.py
@@ -30,8 +30,6 @@
 # TODO: Investigate why this doesn't work on Picolibc once the locale base API is refactored
 # UNSUPPORTED: LIBCXX-PICOLIBC-FIXME
 
-# TODO: Fix seemingly circular inclusion or <wchar.h> on AIX
-# UNSUPPORTED: LIBCXX-AIX-FIXME
 
 # UNSUPPORTED: FROZEN-CXX03-HEADERS-FIXME
 



More information about the libcxx-commits mailing list