[libcxx-commits] [libcxx] [AIX][libc++] Forward-declare locale functions in aix.h when _XOPEN_SOURCE < 700 (PR #220508)
via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Sep 24 21:22:13 PDT 2026
https://github.com/Himadhith updated https://github.com/llvm/llvm-project/pull/220508
>From ab290490202cf1b33e328458d8fc4fdda3704a1c Mon Sep 17 00:00:00 2001
From: himadhith <himadhith.v at ibm.com>
Date: Wed, 2 Sep 2026 03:38:09 -0400
Subject: [PATCH] [AIX][libc++] Forward-declare locale functions in aix.h when
_XOPEN_SOURCE_ < 700
---
libcxx/include/__locale_dir/support/aix.h | 10 ++++++++++
libcxx/test/extensions/posix/xopen_source.gen.py | 4 ----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/libcxx/include/__locale_dir/support/aix.h b/libcxx/include/__locale_dir/support/aix.h
index 17f095ac6ce424..c54021c29242b2 100644
--- a/libcxx/include/__locale_dir/support/aix.h
+++ b/libcxx/include/__locale_dir/support/aix.h
@@ -25,6 +25,16 @@
# include <wctype.h>
#endif
+// Forward declare for _XOPEN_SOURCE=500 and _XOPEN_SOURCE=600
+#if defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 700
+extern "C" {
+locale_t newlocale(int, const char*, locale_t) noexcept;
+locale_t duplocale(locale_t) noexcept;
+locale_t uselocale(locale_t) noexcept;
+void freelocale(locale_t) noexcept;
+}
+#endif // defined(_XOPEN_SOURCE) && _XOPEN_SOURCE < 700
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
#endif
diff --git a/libcxx/test/extensions/posix/xopen_source.gen.py b/libcxx/test/extensions/posix/xopen_source.gen.py
index ac04e38bde38a5..bd14e691de5af1 100644
--- a/libcxx/test/extensions/posix/xopen_source.gen.py
+++ b/libcxx/test/extensions/posix/xopen_source.gen.py
@@ -12,10 +12,6 @@
#
# https://llvm.org/PR117630
-# The AIX localization support uses some functions as part of their headers that require a
-# recent value of _XOPEN_SOURCE.
-# UNSUPPORTED: LIBCXX-AIX-FIXME
-
# FreeBSD maps _XOPEN_SOURCE=500 to __ISO_C_VISIBLE=1990 (see <sys/_visible.h>), which hides
# everything C99 added to the C library, even in C++ mode. libc++ needs some of those
# additions to provide a conforming library at all.
More information about the libcxx-commits
mailing list