[libcxx-commits] [libcxx] [libc++] Add missing __get_local_endcoding on OpenBSD (PR #224954)

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 20 11:49:41 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Sergii Rudchenko (rudchenkos)

<details>
<summary>Changes</summary>

OpenBSD supports nl_langinfo_l(3) since version 6.2.

---
Full diff: https://github.com/llvm/llvm-project/pull/224954.diff


1 Files Affected:

- (modified) libcxx/include/__locale_dir/support/openbsd.h (+5) 


``````````diff
diff --git a/libcxx/include/__locale_dir/support/openbsd.h b/libcxx/include/__locale_dir/support/openbsd.h
index 85f008f8a17f07..e48604c38642fa 100644
--- a/libcxx/include/__locale_dir/support/openbsd.h
+++ b/libcxx/include/__locale_dir/support/openbsd.h
@@ -16,6 +16,7 @@
 #include <__utility/forward.h>
 #include <clocale> // std::lconv
 #include <ctype.h>
+#include <langinfo.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -196,6 +197,10 @@ inline size_t __mbsrtowcs(wchar_t* __dest, const char** __src, size_t __len, mbs
   return mbsrtowcs(__dest, __src, __len, __ps);
 }
 #  endif // _LIBCPP_HAS_WIDE_CHARACTERS
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
+  return ::nl_langinfo_l(CODESET, __loc);
+}
 #endif   // _LIBCPP_BUILDING_LIBRARY
 
 _LIBCPP_DIAGNOSTIC_PUSH

``````````

</details>


https://github.com/llvm/llvm-project/pull/224954


More information about the libcxx-commits mailing list