[libcxx-commits] [libcxx] [libc++] Don't skip localization-related headers in header tests (PR #134877)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 8 09:27:24 PDT 2025
https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/134877
When localization is disabled, we used to skip testing a lot of headers. However, these headers are now "no-ops" when localization is disabled, so they can actually be included. As such, we should test their inclusion in our usual header inclusion tests.
>From 9bb09a162c432b4691df2e73271bb001d19ef2e0 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Tue, 8 Apr 2025 12:17:51 -0400
Subject: [PATCH] [libc++] Don't skip localization-related headers in header
tests
When localization is disabled, we used to skip testing a lot of headers.
However, these headers are now "no-ops" when localization is disabled,
so they can actually be included. As such, we should test their inclusion
in our usual header inclusion tests.
---
libcxx/include/ios | 10 ++++----
libcxx/include/regex | 26 +++++++++----------
libcxx/include/syncstream | 11 ++++----
libcxx/utils/libcxx/header_information.py | 31 -----------------------
4 files changed, 23 insertions(+), 55 deletions(-)
diff --git a/libcxx/include/ios b/libcxx/include/ios
index 98a088266539a..c1a7c94821147 100644
--- a/libcxx/include/ios
+++ b/libcxx/include/ios
@@ -216,6 +216,11 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#else
# include <__config>
+// standard-mandated includes
+
+// [ios.syn]
+# include <iosfwd>
+
# if _LIBCPP_HAS_LOCALIZATION
# include <__fwd/ios.h>
@@ -230,11 +235,6 @@ storage-class-specifier const error_category& iostream_category() noexcept;
# include <__verbose_abort>
# include <version>
-// standard-mandated includes
-
-// [ios.syn]
-# include <iosfwd>
-
# if _LIBCPP_HAS_ATOMIC_HEADER
# include <__atomic/atomic.h> // for __xindex_
# endif
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 067f904d4e699..0d3045ee6d5d1 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -794,6 +794,19 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#else
# include <__config>
+// standard-mandated includes
+
+// [iterator.range]
+# include <__iterator/access.h>
+# include <__iterator/data.h>
+# include <__iterator/empty.h>
+# include <__iterator/reverse_access.h>
+# include <__iterator/size.h>
+
+// [re.syn]
+# include <compare>
+# include <initializer_list>
+
# if _LIBCPP_HAS_LOCALIZATION
# include <__algorithm/find.h>
@@ -817,19 +830,6 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
# include <vector>
# include <version>
-// standard-mandated includes
-
-// [iterator.range]
-# include <__iterator/access.h>
-# include <__iterator/data.h>
-# include <__iterator/empty.h>
-# include <__iterator/reverse_access.h>
-# include <__iterator/size.h>
-
-// [re.syn]
-# include <compare>
-# include <initializer_list>
-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index 089d461450b37..85b8f00716cf6 100644
--- a/libcxx/include/syncstream
+++ b/libcxx/include/syncstream
@@ -122,6 +122,11 @@ namespace std {
#else
# include <__config>
+// standard-mandated includes
+
+// [syncstream.syn]
+# include <ostream>
+
# if _LIBCPP_HAS_LOCALIZATION
# include <__mutex/lock_guard.h>
@@ -130,17 +135,11 @@ namespace std {
# include <iosfwd> // required for declaration of default arguments
# include <streambuf>
# include <string>
-
# if _LIBCPP_HAS_THREADS
# include <map>
# include <shared_mutex>
# endif
-// standard-mandated includes
-
-// [syncstream.syn]
-# include <ostream>
-
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
# endif
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index 9811b42d510ca..12560ad42031a 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -179,29 +179,10 @@ def __hash__(self) -> int:
# headers with #error directives
"atomic": "_LIBCPP_HAS_ATOMIC_HEADER",
"stdatomic.h": "_LIBCPP_HAS_ATOMIC_HEADER",
-
- # headers with #error directives
- "ios": "_LIBCPP_HAS_LOCALIZATION",
- # transitive includers of the above headers
- "clocale": "_LIBCPP_HAS_LOCALIZATION",
- "codecvt": "_LIBCPP_HAS_LOCALIZATION",
- "fstream": "_LIBCPP_HAS_LOCALIZATION",
- "iomanip": "_LIBCPP_HAS_LOCALIZATION",
- "iostream": "_LIBCPP_HAS_LOCALIZATION",
- "istream": "_LIBCPP_HAS_LOCALIZATION",
- "locale": "_LIBCPP_HAS_LOCALIZATION",
- "ostream": "_LIBCPP_HAS_LOCALIZATION",
- "regex": "_LIBCPP_HAS_LOCALIZATION",
- "sstream": "_LIBCPP_HAS_LOCALIZATION",
- "streambuf": "_LIBCPP_HAS_LOCALIZATION",
- "strstream": "_LIBCPP_HAS_LOCALIZATION",
- "syncstream": "_LIBCPP_HAS_LOCALIZATION",
}
lit_header_restrictions = {
"barrier": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "clocale": "// UNSUPPORTED: no-localization",
- "codecvt": "// UNSUPPORTED: no-localization",
"coroutine": "// UNSUPPORTED: c++03, c++11, c++14, c++17",
"cwchar": "// UNSUPPORTED: no-wide-characters",
"cwctype": "// UNSUPPORTED: no-wide-characters",
@@ -211,26 +192,14 @@ def __hash__(self) -> int:
"experimental/type_traits": "// UNSUPPORTED: c++03",
"experimental/utility": "// UNSUPPORTED: c++03",
"filesystem": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14",
- "fstream": "// UNSUPPORTED: no-localization, no-filesystem",
"future": "// UNSUPPORTED: no-threads, c++03",
- "iomanip": "// UNSUPPORTED: no-localization",
- "ios": "// UNSUPPORTED: no-localization",
- "iostream": "// UNSUPPORTED: no-localization",
- "istream": "// UNSUPPORTED: no-localization",
"latch": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
- "locale": "// UNSUPPORTED: no-localization",
"mutex": "// UNSUPPORTED: no-threads, c++03",
- "ostream": "// UNSUPPORTED: no-localization",
"print": "// UNSUPPORTED: no-filesystem, c++03, c++11, c++14, c++17, c++20, availability-fp_to_chars-missing", # TODO PRINT investigate
- "regex": "// UNSUPPORTED: no-localization",
"semaphore": "// UNSUPPORTED: no-threads, c++03, c++11, c++14, c++17",
"shared_mutex": "// UNSUPPORTED: no-threads, c++03, c++11",
- "sstream": "// UNSUPPORTED: no-localization",
"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",
- "streambuf": "// UNSUPPORTED: no-localization",
- "strstream": "// UNSUPPORTED: no-localization",
- "syncstream": "// UNSUPPORTED: no-localization",
"thread": "// UNSUPPORTED: no-threads, c++03",
"wchar.h": "// UNSUPPORTED: no-wide-characters",
"wctype.h": "// UNSUPPORTED: no-wide-characters",
More information about the libcxx-commits
mailing list