[libcxx-commits] [libcxx] 5f282ce - [libc++] Assume that <wchar.h> in llvm-libc has const-overloads. (#206805)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 1 08:09:58 PDT 2026


Author: Alexey Samsonov
Date: 2026-07-01T08:09:53-07:00
New Revision: 5f282ce09f961d33414bb6c42a57b907efcb6aec

URL: https://github.com/llvm/llvm-project/commit/5f282ce09f961d33414bb6c42a57b907efcb6aec
DIFF: https://github.com/llvm/llvm-project/commit/5f282ce09f961d33414bb6c42a57b907efcb6aec.diff

LOG: [libc++] Assume that <wchar.h> in llvm-libc has const-overloads. (#206805)

See discussion in https://github.com/llvm/llvm-project/pull/201236 -
we're close to enabling wide characters in libc++ when it's built on top
of llvm-libc.

llvm-libc headers use `const wchar_t*` return type for selected wchar
functions, so we need to configure libc++ to assume that const-overloads
for these functions are available in this case, and the implementations
in libc++ wrapper around `<wchar.h>` are not needed.

Added: 
    

Modified: 
    libcxx/include/wchar.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/wchar.h b/libcxx/include/wchar.h
index a932dd266b862..7ff03870bdfdb 100644
--- a/libcxx/include/wchar.h
+++ b/libcxx/include/wchar.h
@@ -133,6 +133,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
 #      if defined(_CRT_CONST_CORRECT_OVERLOADS)
 #        define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
 #      endif
+#    elif _LIBCPP_LIBC_LLVM_LIBC
+#      define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
 #    endif
 
 #    if _LIBCPP_HAS_WIDE_CHARACTERS


        


More information about the libcxx-commits mailing list