[libcxx-commits] [libcxx] [libc++] Enable header tests under all configurations (PR #202543)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 9 01:55:00 PDT 2026
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/202543
Most of the header tests (e.g. double_include) only check that headers
are includable or have properties that hold all the time, regardless of
any active carve-outs. In accordance with that, this patch enables said
tests even when carve-outs are active.
Only the transitive inclusion test is kept disabled by carve-outs because
the transitive includes can't reasonably be maintained when carve-outs
are active.
Related to #202246 and #202001.
>From ee0ed05d15a3bec412c3bd0796bc4b3ee77cdc7b Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 9 Jun 2026 10:14:18 +0200
Subject: [PATCH 1/2] [libc++] Temporary cherry-pick of
https://github.com/llvm/llvm-project/pull/202535
---
libcxx/include/thread | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libcxx/include/thread b/libcxx/include/thread
index f252273ebadcd..a8f7958346554 100644
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -91,6 +91,11 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#else
# include <__config>
+// standard-mandated includes
+
+// [thread.syn]
+# include <compare>
+
# if _LIBCPP_HAS_THREADS
# include <__thread/this_thread.h>
@@ -106,11 +111,6 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
# include <version>
-// standard-mandated includes
-
-// [thread.syn]
-# include <compare>
-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
>From 246d0fd55842a6f19ae6eb338367310cb9eb925a Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 9 Jun 2026 10:14:35 +0200
Subject: [PATCH 2/2] [libc++] Enable header tests under all configurations
Most of the header tests (e.g. double_include) only check that headers
are includable or have properties that hold all the time, regardless of
any active carve-outs. In accordance with that, this patch enables said
tests even when carve-outs are active.
Only the transitive inclusion test is kept disabled by carve-outs because
the transitive includes can't reasonably be maintained when carve-outs
are active.
---
.../clang/clang_modules_include.gen.py | 2 --
.../extensions/libcxx/libcpp_version.gen.py | 2 --
.../libcxx/no_assert_include.gen.py | 2 --
.../test/extensions/posix/xopen_source.gen.py | 2 --
libcxx/test/libcxx/clang_tidy.gen.py | 3 +-
.../test/libcxx/system_reserved_names.gen.py | 2 --
libcxx/test/libcxx/transitive_includes.gen.py | 28 ++++++++++++++++++-
libcxx/test/std/double_include.gen.py | 2 --
libcxx/test/std/header_inclusions.gen.py | 2 --
.../mandatory_inclusions.gen.py | 2 --
libcxx/utils/libcxx/header_information.py | 24 ----------------
11 files changed, 28 insertions(+), 43 deletions(-)
diff --git a/libcxx/test/extensions/clang/clang_modules_include.gen.py b/libcxx/test/extensions/clang/clang_modules_include.gen.py
index 28661049d6e85..ed058cd908511 100644
--- a/libcxx/test/extensions/clang/clang_modules_include.gen.py
+++ b/libcxx/test/extensions/clang/clang_modules_include.gen.py
@@ -41,7 +41,6 @@
import sys
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -52,7 +51,6 @@
//--- {header}.compile.pass.cpp
// RUN: %{{cxx}} %s %{{flags}} %{{compile_flags}} -fmodules -fcxx-modules -fmodules-cache-path=%t -fsyntax-only
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
#include <{header}>
diff --git a/libcxx/test/extensions/libcxx/libcpp_version.gen.py b/libcxx/test/extensions/libcxx/libcpp_version.gen.py
index ebeab777c934f..31b1760f864ed 100644
--- a/libcxx/test/extensions/libcxx/libcpp_version.gen.py
+++ b/libcxx/test/extensions/libcxx/libcpp_version.gen.py
@@ -13,7 +13,6 @@
import sys
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -22,7 +21,6 @@
print(
f"""\
//--- {header}.compile.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
#include <{header}>
diff --git a/libcxx/test/extensions/libcxx/no_assert_include.gen.py b/libcxx/test/extensions/libcxx/no_assert_include.gen.py
index e0dbc3d815f31..d206ac5cd459a 100644
--- a/libcxx/test/extensions/libcxx/no_assert_include.gen.py
+++ b/libcxx/test/extensions/libcxx/no_assert_include.gen.py
@@ -15,7 +15,6 @@
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -27,7 +26,6 @@
print(
f"""\
//--- {header}.compile.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
#include <{header}>
diff --git a/libcxx/test/extensions/posix/xopen_source.gen.py b/libcxx/test/extensions/posix/xopen_source.gen.py
index e98197c8ed21c..99e0b0b7c7d1f 100644
--- a/libcxx/test/extensions/posix/xopen_source.gen.py
+++ b/libcxx/test/extensions/posix/xopen_source.gen.py
@@ -26,7 +26,6 @@
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -40,7 +39,6 @@
print(
f"""\
//--- {header}.xopen_source_{version}.compile.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
// ADDITIONAL_COMPILE_FLAGS: -D_XOPEN_SOURCE={version}
diff --git a/libcxx/test/libcxx/clang_tidy.gen.py b/libcxx/test/libcxx/clang_tidy.gen.py
index 48527e3617f90..10dfe053f5ccb 100644
--- a/libcxx/test/libcxx/clang_tidy.gen.py
+++ b/libcxx/test/libcxx/clang_tidy.gen.py
@@ -18,12 +18,11 @@
import sys
sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, lit_header_undeprecations, public_headers
+from libcxx.header_information import lit_header_undeprecations, public_headers
for header in public_headers:
print(f"""\
//--- {header}.sh.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
// TODO: run clang-tidy with modules enabled once they are supported
diff --git a/libcxx/test/libcxx/system_reserved_names.gen.py b/libcxx/test/libcxx/system_reserved_names.gen.py
index bb0bbeb1caf82..aaaa385409be4 100644
--- a/libcxx/test/libcxx/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx/system_reserved_names.gen.py
@@ -17,7 +17,6 @@
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -26,7 +25,6 @@
print(
f"""\
//--- {header}.compile.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
// This is required to detect the platform we're building for below.
diff --git a/libcxx/test/libcxx/transitive_includes.gen.py b/libcxx/test/libcxx/transitive_includes.gen.py
index 1ff80af1b5e1d..dac8e22a16142 100644
--- a/libcxx/test/libcxx/transitive_includes.gen.py
+++ b/libcxx/test/libcxx/transitive_includes.gen.py
@@ -21,10 +21,36 @@
import sys
sys.path.append(sys.argv[1])
-from libcxx.header_information import lit_header_restrictions, public_headers
+from libcxx.header_information import public_headers
import re
+# Headers whose transitive-includes we don't track in carved-out configurations
+# or older standard modes.
+lit_header_restrictions = {
+ "barrier": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
+ "coroutine": "// UNSUPPORTED: c++03, c++11, c++14, c++17",
+ "cwchar": "// UNSUPPORTED: no-wide-characters",
+ "cwctype": "// UNSUPPORTED: no-wide-characters",
+ "experimental/iterator": "// UNSUPPORTED: c++03",
+ "experimental/propagate_const": "// UNSUPPORTED: c++03",
+ "experimental/simd": "// UNSUPPORTED: c++03",
+ "experimental/type_traits": "// UNSUPPORTED: c++03",
+ "experimental/utility": "// UNSUPPORTED: c++03",
+ "filesystem": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14",
+ "future": "// UNSUPPORTED: no-threads, c++03",
+ "latch": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
+ "mutex": "// UNSUPPORTED: no-threads, c++03",
+ "print": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14, c++17, c++20, availability-fp_to_chars-missing", # TODO PRINT investigate
+ "semaphore": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
+ "shared_mutex": "// UNSUPPORTED: no-threads, c++03, c++11",
+ "stdatomic.h": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17, c++20",
+ "stop_token": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
+ "thread": "// UNSUPPORTED: no-threads, c++03",
+ "wchar.h": "// UNSUPPORTED: no-wide-characters",
+ "wctype.h": "// UNSUPPORTED: no-wide-characters",
+}
+
# To re-generate the list of expected headers, temporarily set this to True, and run this test.
# Note that this needs to be done for all supported language versions of libc++:
# for std in c++03 c++11 c++14 c++17 c++20 c++23 c++26; do <build>/bin/llvm-lit --param std=$std libcxx/test/libcxx/transitive_includes.gen.py; done
diff --git a/libcxx/test/std/double_include.gen.py b/libcxx/test/std/double_include.gen.py
index f019710be55b2..21ca2faab80da 100644
--- a/libcxx/test/std/double_include.gen.py
+++ b/libcxx/test/std/double_include.gen.py
@@ -17,7 +17,6 @@
import sys
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
)
@@ -26,7 +25,6 @@
print(
f"""\
//--- {header}.sh.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
// RUN: %{{cxx}} -c %s -o %t.first.o %{{flags}} %{{compile_flags}}
diff --git a/libcxx/test/std/header_inclusions.gen.py b/libcxx/test/std/header_inclusions.gen.py
index cebff94fdd1ab..45b397587a9c6 100644
--- a/libcxx/test/std/header_inclusions.gen.py
+++ b/libcxx/test/std/header_inclusions.gen.py
@@ -21,7 +21,6 @@
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
public_headers,
mandatory_inclusions,
@@ -51,7 +50,6 @@
print(
f"""\
//--- {header}.compile.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
#include <{header}>
diff --git a/libcxx/test/std/iterators/iterator.range/mandatory_inclusions.gen.py b/libcxx/test/std/iterators/iterator.range/mandatory_inclusions.gen.py
index 34ede107e5ed6..043374df1fad1 100644
--- a/libcxx/test/std/iterators/iterator.range/mandatory_inclusions.gen.py
+++ b/libcxx/test/std/iterators/iterator.range/mandatory_inclusions.gen.py
@@ -21,7 +21,6 @@
sys.path.append(sys.argv[1])
from libcxx.header_information import (
- lit_header_restrictions,
lit_header_undeprecations,
Header,
)
@@ -53,7 +52,6 @@
print(
f"""\
//--- {header}.pass.cpp
-{lit_header_restrictions.get(header, '')}
{lit_header_undeprecations.get(header, '')}
#include <{header}>
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index d06271a7908cc..83d3ba0d4f0f4 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -181,30 +181,6 @@ def __hash__(self) -> int:
"stdatomic.h": "_LIBCPP_HAS_ATOMIC_HEADER",
}
-lit_header_restrictions = {
- "barrier": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "coroutine": "// UNSUPPORTED: c++03, c++11, c++14, c++17",
- "cwchar": "// UNSUPPORTED: no-wide-characters",
- "cwctype": "// UNSUPPORTED: no-wide-characters",
- "experimental/iterator": "// UNSUPPORTED: c++03",
- "experimental/propagate_const": "// UNSUPPORTED: c++03",
- "experimental/simd": "// UNSUPPORTED: c++03",
- "experimental/type_traits": "// UNSUPPORTED: c++03",
- "experimental/utility": "// UNSUPPORTED: c++03",
- "filesystem": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14",
- "future": "// UNSUPPORTED: no-threads, c++03",
- "latch": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "mutex": "// UNSUPPORTED: no-threads, c++03",
- "print": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14, c++17, c++20, availability-fp_to_chars-missing", # TODO PRINT investigate
- "semaphore": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "shared_mutex": "// UNSUPPORTED: no-threads, c++03, c++11",
- "stdatomic.h": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17, c++20",
- "stop_token": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "thread": "// UNSUPPORTED: no-threads, c++03",
- "wchar.h": "// UNSUPPORTED: no-wide-characters",
- "wctype.h": "// UNSUPPORTED: no-wide-characters",
-}
-
# Undeprecate headers that are deprecated in C++17 and removed in C++20.
lit_header_undeprecations = {
"ccomplex": "// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_DEPRECATION_WARNINGS",
More information about the libcxx-commits
mailing list