[libc-commits] [libc] [libc] Add nl_langinfo and nl_langinfo_l implementations (PR #243540)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Nov 20 02:38:32 PST 2026
================
@@ -0,0 +1,35 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Implementation of nl_langinfo.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/langinfo/nl_langinfo.h"
+#include "hdr/locale_macros.h"
+#include "hdr/types/locale_t.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+#include "src/langinfo/langinfo_utils.h"
+#include "src/locale/locale.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(char *, nl_langinfo, (nl_item item)) {
+ locale_t loc = nullptr;
+ if constexpr (ENABLE_RUNTIME_LOCALE) {
+ loc = get_thread_locale();
+ if (loc == nullptr || loc == LC_GLOBAL_LOCALE)
+ loc = get_global_locale();
+ }
----------------
kaladron wrote:
That RFC is now posted: https://discourse.llvm.org/t/rfc-fixed-c-utf-8-default-locale-and-l-only-localisation/92924
https://github.com/llvm/llvm-project/pull/243540
More information about the libc-commits
mailing list