[libcxx-commits] [libcxx] [libcxx] fix missing `__get_locale_encoding()` for OpenBSD (PR #228306)
Alex Rønne Petersen via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Oct 1 19:16:30 PDT 2026
https://github.com/alexrp created https://github.com/llvm/llvm-project/pull/228306
Fixes errors like this:
/home/alexrp/Sources/ziglang/zig-llvm23/lib/libcxx/src/text_encoding.cpp:34:43: error: no member named '__get_locale_encoding' in namespace
'std::__locale'
34 | return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(0)));
| ^~~~~~~~~~~~~~~~~~~~~
/home/alexrp/Sources/ziglang/zig-llvm23/lib/libcxx/src/text_encoding.cpp:48:41: error: no member named '__get_locale_encoding' in namespace
'std::__locale'
48 | return __make_text_encoding(__locale::__get_locale_encoding(__l));
| ^~~~~~~~~~~~~~~~~~~~~
2 errors generated.
>From 1e2f467c48a342fbd0c5a6be426313e3ffc721dc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alex=20R=C3=B8nne=20Petersen?= <alex at alexrp.com>
Date: Fri, 2 Oct 2026 04:13:33 +0200
Subject: [PATCH] [libcxx] fix missing __get_locale_encoding() for OpenBSD
Fixes errors like this:
/home/alexrp/Sources/ziglang/zig-llvm23/lib/libcxx/src/text_encoding.cpp:34:43: error: no member named '__get_locale_encoding' in namespace
'std::__locale'
34 | return __make_text_encoding(__locale::__get_locale_encoding(static_cast<__locale::__locale_t>(0)));
| ^~~~~~~~~~~~~~~~~~~~~
/home/alexrp/Sources/ziglang/zig-llvm23/lib/libcxx/src/text_encoding.cpp:48:41: error: no member named '__get_locale_encoding' in namespace
'std::__locale'
48 | return __make_text_encoding(__locale::__get_locale_encoding(__l));
| ^~~~~~~~~~~~~~~~~~~~~
2 errors generated.
---
libcxx/include/__locale_dir/support/openbsd.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libcxx/include/__locale_dir/support/openbsd.h b/libcxx/include/__locale_dir/support/openbsd.h
index 369b8e652689beb..b22cdf38b10ece8 100644
--- a/libcxx/include/__locale_dir/support/openbsd.h
+++ b/libcxx/include/__locale_dir/support/openbsd.h
@@ -24,6 +24,9 @@
# include <wchar.h>
# include <wctype.h>
#endif
+#if defined(_LIBCPP_BUILDING_LIBRARY)
+# include <langinfo.h>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
@@ -74,6 +77,10 @@ inline __lconv_t* __localeconv(__locale_t& __loc) {
__locale_guard __current(__loc);
return ::localeconv();
}
+
+inline _LIBCPP_HIDE_FROM_ABI const char* __get_locale_encoding(__locale_t __loc) {
+ return ::nl_langinfo_l(CODESET, __loc);
+}
#endif // _LIBCPP_BUILDING_LIBRARY
//
More information about the libcxx-commits
mailing list