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

Sergii Rudchenko via libcxx-commits libcxx-commits at lists.llvm.org
Sun Sep 20 11:48:10 PDT 2026


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

OpenBSD supports nl_langinfo_l(3) since version 6.2.

>From ac495dbb03adf72f2a50a2d505040aabba85b484 Mon Sep 17 00:00:00 2001
From: Sergii Rudchenko <rudchenkos at gmail.com>
Date: Sun, 20 Sep 2026 20:42:05 +0200
Subject: [PATCH] [libc++] Add missing __get_local_endcoding on OpenBSD

OpenBSD supports nl_langinfo_l(3) since version 6.2.
---
 libcxx/include/__locale_dir/support/openbsd.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libcxx/include/__locale_dir/support/openbsd.h b/libcxx/include/__locale_dir/support/openbsd.h
index 85f008f8a17f0..e48604c38642f 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



More information about the libcxx-commits mailing list