[libcxx-commits] [libcxx] [libc++] Mark xopen_source test unsupported on OpenBSD (PR #233710)

Brad Smith via libcxx-commits libcxx-commits at lists.llvm.org
Mon Oct 19 23:10:19 PDT 2026


https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/233710

OpenBSD's headers strictly honor _XOPEN_SOURCE. With 500 and 600 the
POSIX.1-2008 locale API (locale_t, uselocale(), LC_*_MASK) is hidden,
and with any value below 800 asprintf() is hidden since it is only
exposed for POSIX.1-2024 or the BSD namespace. libc++'s OpenBSD locale
support relies on these from public headers, so every generated test
fails.

Add an openbsd lit feature and mark the test unsupported, as is
already done for FreeBSD.

>From a7c1624729c39154a8bfaadd09dc2b84ee5eb18d Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Tue, 20 Oct 2026 01:59:35 -0400
Subject: [PATCH] [libc++] Mark xopen_source test unsupported on OpenBSD

OpenBSD's headers strictly honor _XOPEN_SOURCE. With 500 and 600 the
POSIX.1-2008 locale API (locale_t, uselocale(), LC_*_MASK) is hidden,
and with any value below 800 asprintf() is hidden since it is only
exposed for POSIX.1-2024 or the BSD namespace. libc++'s OpenBSD locale
support relies on these from public headers, so every generated test
fails.

Add an openbsd lit feature and mark the test unsupported, as is
already done for FreeBSD.
---
 libcxx/test/extensions/posix/xopen_source.gen.py | 6 ++++++
 libcxx/utils/libcxx/test/features/platform.py    | 1 +
 2 files changed, 7 insertions(+)

diff --git a/libcxx/test/extensions/posix/xopen_source.gen.py b/libcxx/test/extensions/posix/xopen_source.gen.py
index bd14e691de5af..b6318cec324ce 100644
--- a/libcxx/test/extensions/posix/xopen_source.gen.py
+++ b/libcxx/test/extensions/posix/xopen_source.gen.py
@@ -17,6 +17,12 @@
 # additions to provide a conforming library at all.
 # UNSUPPORTED: freebsd
 
+# OpenBSD's <sys/cdefs.h> honors _XOPEN_SOURCE strictly: 500 and 600 hide the POSIX.1-2008
+# locale API (locale_t, uselocale(), LC_*_MASK), and every value below 800 hides asprintf(),
+# which is only exposed for POSIX.1-2024 or __BSD_VISIBLE. libc++'s locale support needs all
+# of these from its public headers (e.g. money_put uses __locale::__asprintf).
+# UNSUPPORTED: openbsd
+
 # RUN: %{python} %s %{libcxx-dir}/utils
 # END.
 
diff --git a/libcxx/utils/libcxx/test/features/platform.py b/libcxx/utils/libcxx/test/features/platform.py
index 5ce4b4a090e49..8af3edf531148 100644
--- a/libcxx/utils/libcxx/test/features/platform.py
+++ b/libcxx/utils/libcxx/test/features/platform.py
@@ -84,6 +84,7 @@ def _getAndroidDeviceApi(cfg):
     ),
     Feature(name="netbsd", when=lambda cfg: "__NetBSD__" in compilerMacros(cfg)),
     Feature(name="freebsd", when=lambda cfg: "__FreeBSD__" in compilerMacros(cfg)),
+    Feature(name="openbsd", when=lambda cfg: "__OpenBSD__" in compilerMacros(cfg)),
     Feature(
         name="LIBCXX-FREEBSD-FIXME",
         when=lambda cfg: "__FreeBSD__" in compilerMacros(cfg),



More information about the libcxx-commits mailing list