From f2da8e3790d54574d56f60a53f80c46f3881860b Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 8 Apr 2025 12:17:51 -0400 Subject: [PATCH 1/3] [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 | 30 +++++++++++----------- libcxx/include/syncstream | 11 ++++---- libcxx/utils/libcxx/header_information.py | 31 ----------------------- 4 files changed, 25 insertions(+), 57 deletions(-) diff --git a/libcxx/include/ios b/libcxx/include/ios index 9e48ec88ce59d..78fc9d610987d 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 + # 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 -// standard-mandated includes - -// [ios.syn] -# include - # if _LIBCPP_HAS_ATOMIC_HEADER # include <__atomic/atomic.h> // for __xindex_ # endif diff --git a/libcxx/include/regex b/libcxx/include/regex index 12fc0787dcd5f..7e50b16af3ced 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -794,6 +794,19 @@ typedef regex_token_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 +# include + # if _LIBCPP_HAS_LOCALIZATION # include <__algorithm/find.h> @@ -817,19 +830,6 @@ typedef regex_token_iterator wsregex_token_iterator; # include # include -// 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 -# include - # if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header # endif @@ -5336,8 +5336,8 @@ typedef regex_iterator wsregex_iterator; template class _LIBCPP_PREFERRED_NAME(cregex_iterator) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator)) - _LIBCPP_PREFERRED_NAME(sregex_iterator) - _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) regex_iterator { + _LIBCPP_PREFERRED_NAME(sregex_iterator) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) + regex_iterator { public: typedef basic_regex<_CharT, _Traits> regex_type; typedef match_results<_BidirectionalIterator> value_type; diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream index ffa0ed8001efd..1f7605e06aa21 100644 --- a/libcxx/include/syncstream +++ b/libcxx/include/syncstream @@ -122,6 +122,11 @@ namespace std { #else # include <__config> +// standard-mandated includes + +// [syncstream.syn] +# include + # if _LIBCPP_HAS_LOCALIZATION # include <__mutex/lock_guard.h> @@ -130,17 +135,11 @@ namespace std { # include // required for declaration of default arguments # include # include - # if _LIBCPP_HAS_THREADS # include # include # endif -// standard-mandated includes - -// [syncstream.syn] -# include - # 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 a505d37b65b81..d06271a7908cc 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", From 3775afb58a72f8cc31725221328220647d6acf2a Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Tue, 6 May 2025 15:56:23 -0400 Subject: [PATCH 2/3] Regenerate files --- libcxx/modules/std.compat.cppm.in | 4 +-- libcxx/modules/std.cppm.in | 56 ++++++++----------------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in index 95931447ccdc6..dd7385bf33a42 100644 --- a/libcxx/modules/std.compat.cppm.in +++ b/libcxx/modules/std.compat.cppm.in @@ -24,9 +24,7 @@ module; #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in index 5c523691bff4e..984b18321923c 100644 --- a/libcxx/modules/std.cppm.in +++ b/libcxx/modules/std.cppm.in @@ -35,13 +35,9 @@ module; #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include @@ -68,32 +64,20 @@ module; #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include +#include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include +#include #include #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include @@ -103,40 +87,28 @@ module; #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include #include #include -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif -#if _LIBCPP_HAS_LOCALIZATION -# include -#endif +#include +#include #include #include #include From a4da0849af529b27ad3128e43d19fb50c52a08c2 Mon Sep 17 00:00:00 2001 From: Louis Dionne Date: Thu, 8 May 2025 16:37:12 -0400 Subject: [PATCH 3/3] Format --- libcxx/include/regex | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libcxx/include/regex b/libcxx/include/regex index 7e50b16af3ced..bbc21e244dd17 100644 --- a/libcxx/include/regex +++ b/libcxx/include/regex @@ -5336,8 +5336,8 @@ typedef regex_iterator wsregex_iterator; template class _LIBCPP_PREFERRED_NAME(cregex_iterator) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wcregex_iterator)) - _LIBCPP_PREFERRED_NAME(sregex_iterator) _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) - regex_iterator { + _LIBCPP_PREFERRED_NAME(sregex_iterator) + _LIBCPP_IF_WIDE_CHARACTERS(_LIBCPP_PREFERRED_NAME(wsregex_iterator)) regex_iterator { public: typedef basic_regex<_CharT, _Traits> regex_type; typedef match_results<_BidirectionalIterator> value_type;