[libcxx-commits] [libcxx] [libc++] Add missing xlocale.h include on Apple and FreeBSD (PR #99689)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 12:31:16 PDT 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/99689

The <locale> header uses strtoll_l and friends which are defined in <xlocale.h> on these platforms. While this works via transitive includes when modules are disabled, this doesn't work anymore if the platforms are modularized properly.

>From 9cec7d31c740f72f9154ac70a43d1d1262158072 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Fri, 19 Jul 2024 15:28:50 -0400
Subject: [PATCH] [libc++] Add missing xlocale.h include on Apple and FreeBSD

The <locale> header uses strtoll_l and friends which are defined
in <xlocale.h> on these platforms. While this works via transitive
includes when modules are disabled, this doesn't work anymore if
the platforms are modularized properly.
---
 libcxx/include/locale | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libcxx/include/locale b/libcxx/include/locale
index dbec23a2c936d..573910a85bef5 100644
--- a/libcxx/include/locale
+++ b/libcxx/include/locale
@@ -232,6 +232,10 @@ template <class charT> class messages_byname;
 #    include <__locale_dir/locale_base_api/bsd_locale_fallbacks.h>
 #  endif
 
+#  if defined(__APPLE__) || defined(__FreeBSD__)
+#    include <xlocale.h>
+#  endif
+
 #  if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #    pragma GCC system_header
 #  endif



More information about the libcxx-commits mailing list