[libcxx-commits] [libcxx] 3912742 - [libc++] Enable header tests under all configurations (#202543)

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 15 03:39:08 PDT 2026


Author: Louis Dionne
Date: 2026-06-15T06:39:03-04:00
New Revision: 39127426ec631583371f23a61deeb6d5b1d57c45

URL: https://github.com/llvm/llvm-project/commit/39127426ec631583371f23a61deeb6d5b1d57c45
DIFF: https://github.com/llvm/llvm-project/commit/39127426ec631583371f23a61deeb6d5b1d57c45.diff

LOG: [libc++] Enable header tests under all configurations (#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.

Added: 
    

Modified: 
    libcxx/test/extensions/clang/clang_modules_include.gen.py
    libcxx/test/extensions/libcxx/libcpp_version.gen.py
    libcxx/test/extensions/libcxx/no_assert_include.gen.py
    libcxx/test/extensions/posix/xopen_source.gen.py
    libcxx/test/libcxx-03/clang_tidy.gen.py
    libcxx/test/libcxx-03/no_assert_include.gen.py
    libcxx/test/libcxx-03/system_reserved_names.gen.py
    libcxx/test/libcxx-03/transitive_includes.gen.py
    libcxx/test/libcxx/clang_tidy.gen.py
    libcxx/test/libcxx/system_reserved_names.gen.py
    libcxx/test/libcxx/transitive_includes.gen.py
    libcxx/test/std/double_include.gen.py
    libcxx/test/std/header_inclusions.gen.py
    libcxx/test/std/iterators/iterator.range/mandatory_inclusions.gen.py
    libcxx/utils/libcxx/header_information.py

Removed: 
    


################################################################################
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-03/clang_tidy.gen.py b/libcxx/test/libcxx-03/clang_tidy.gen.py
index 5926f521e780e..7641abd9d00b4 100644
--- a/libcxx/test/libcxx-03/clang_tidy.gen.py
+++ b/libcxx/test/libcxx-03/clang_tidy.gen.py
@@ -21,12 +21,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-03/no_assert_include.gen.py b/libcxx/test/libcxx-03/no_assert_include.gen.py
index e0dbc3d815f31..d206ac5cd459a 100644
--- a/libcxx/test/libcxx-03/no_assert_include.gen.py
+++ b/libcxx/test/libcxx-03/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/libcxx-03/system_reserved_names.gen.py b/libcxx/test/libcxx-03/system_reserved_names.gen.py
index 43c008823a85e..810765858346f 100644
--- a/libcxx/test/libcxx-03/system_reserved_names.gen.py
+++ b/libcxx/test/libcxx-03/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-03/transitive_includes.gen.py b/libcxx/test/libcxx-03/transitive_includes.gen.py
index 3ab9986bdb94c..f71a2322ba63b 100644
--- a/libcxx/test/libcxx-03/transitive_includes.gen.py
+++ b/libcxx/test/libcxx-03/transitive_includes.gen.py
@@ -23,7 +23,7 @@
 
 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
 
@@ -70,7 +70,6 @@
         print(
             f"""\
 //--- {header}.sh.cpp
-{lit_header_restrictions.get(header, '')}
 
 // TODO: Fix this test to make it work with localization or wide characters disabled
 // UNSUPPORTED: no-localization, no-wide-characters, no-threads, no-filesystem, libcpp-has-no-experimental-tzdb

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..198a155ac0ee5 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 384ff9f759460..5e4c98675e41b 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -175,30 +175,6 @@ def __hash__(self) -> int:
     "text_encoding",
 ]))
 
-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