-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[libc++] Don't skip localization-related headers in header tests #134877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[libc++] Don't skip localization-related headers in header tests #134877
Conversation
Related to #134681 |
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesWhen 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. Full diff: https://github.com/llvm/llvm-project/pull/134877.diff 4 Files Affected:
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",
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The patch to me makes sense, but I was surprised that no generated files are affected. Based on the CI there are files affected. Can you regenerate the files?
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.
9bb09a1
to
3775afb
Compare
✅ With the latest revision this PR passed the C/C++ code formatter. |
@mordante Please let me know what you think of the patch now that I re-generated the files! |
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.