[libcxx-commits] [libcxx] [libcxx][FreeBSD] Mark unsupported only in XOPEN=500 (PR #216002)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 13 03:03:21 PDT 2026


https://github.com/aokblast created https://github.com/llvm/llvm-project/pull/216002

FreeBSD hides all C99 definition when -D_XOPEN_SOURCE=500. As a result, we can turn on these tests if we have definition higher than 500.

>From cad2a3fe2b632c8b3782e58695c436a823126cc3 Mon Sep 17 00:00:00 2001
From: ShengYi Hung <aokblast at FreeBSD.org>
Date: Thu, 13 Aug 2026 18:01:08 +0800
Subject: [PATCH] [libcxx][FreeBSD] Mark unsupported only in XOPEN=500

FreeBSD hides all C99 definition when -D_XOPEN_SOURCE=500. As a result,
we can turn on these tests if we have definition higher than 500.
---
 libcxx/test/extensions/posix/xopen_source.gen.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/libcxx/test/extensions/posix/xopen_source.gen.py b/libcxx/test/extensions/posix/xopen_source.gen.py
index 99e0b0b7c7d1f..ea508445c84aa 100644
--- a/libcxx/test/extensions/posix/xopen_source.gen.py
+++ b/libcxx/test/extensions/posix/xopen_source.gen.py
@@ -16,9 +16,6 @@
 # recent value of _XOPEN_SOURCE.
 # UNSUPPORTED: LIBCXX-AIX-FIXME
 
-# This test fails on FreeBSD for an unknown reason.
-# UNSUPPORTED: LIBCXX-FREEBSD-FIXME
-
 # RUN: %{python} %s %{libcxx-dir}/utils
 # END.
 
@@ -36,11 +33,16 @@
         if header == "fstream" and version == 500:
             continue
 
+        # 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
+        freebsd_unsupported = "// UNSUPPORTED: freebsd\n" if version == 500 else ""
+
         print(
             f"""\
 //--- {header}.xopen_source_{version}.compile.pass.cpp
 {lit_header_undeprecations.get(header, '')}
-
+{freebsd_unsupported}
 // ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE={version}
 
 // Some parts of the code like <fstream> use non-standard functions in their implementation,



More information about the libcxx-commits mailing list