-
Notifications
You must be signed in to change notification settings - Fork 11.9k
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
[libc++] Remove obsolete header restrictions for _LIBCPP_HAS_NO_THREADS #107437
Merged
ldionne
merged 1 commit into
llvm:main
from
ldionne:review/remove-obsolete-header-restrictions
Sep 11, 2024
Merged
[libc++] Remove obsolete header restrictions for _LIBCPP_HAS_NO_THREADS #107437
ldionne
merged 1 commit into
llvm:main
from
ldionne:review/remove-obsolete-header-restrictions
Sep 11, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
llvmbot
added
the
libc++
libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
label
Sep 5, 2024
@llvm/pr-subscribers-libcxx Author: Louis Dionne (ldionne) ChangesThe _LIBCPP_HAS_NO_THREADS and _LIBCPP_HAS_NO_LOCALIZATION carve-outs do not result in hard errors anymore, but the patch that changed that forgot to update the header restrictions we use to auto-generate several files. Full diff: https://github.com/llvm/llvm-project/pull/107437.diff 4 Files Affected:
diff --git a/libcxx/include/__std_clang_module b/libcxx/include/__std_clang_module
index 18d6ce6b46c1f6..703c8099ed584a 100644
--- a/libcxx/include/__std_clang_module
+++ b/libcxx/include/__std_clang_module
@@ -33,9 +33,7 @@
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <barrier>
-#endif
+#include <barrier>
#include <bit>
#include <bitset>
#include <cassert>
@@ -49,13 +47,9 @@
#include <cinttypes>
#include <ciso646>
#include <climits>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <clocale>
-#endif
+#include <clocale>
#include <cmath>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <codecvt>
-#endif
+#include <codecvt>
#include <compare>
#include <complex.h>
#include <complex>
@@ -97,40 +91,22 @@
#include <float.h>
#include <format>
#include <forward_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <fstream>
-#endif
+#include <fstream>
#include <functional>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <future>
-#endif
+#include <future>
#include <initializer_list>
#include <inttypes.h>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iomanip>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ios>
-#endif
+#include <iomanip>
+#include <ios>
#include <iosfwd>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iostream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <istream>
-#endif
+#include <iostream>
+#include <istream>
#include <iterator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <latch>
-#endif
+#include <latch>
#include <limits>
#include <list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <locale.h>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <locale>
-#endif
+#include <locale.h>
+#include <locale>
#include <map>
#include <math.h>
#include <mdspan>
@@ -141,60 +117,38 @@
#include <numbers>
#include <numeric>
#include <optional>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ostream>
-#endif
+#include <ostream>
#include <print>
#include <queue>
#include <random>
#include <ranges>
#include <ratio>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <regex>
-#endif
+#include <regex>
#include <scoped_allocator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <semaphore>
-#endif
+#include <semaphore>
#include <set>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <shared_mutex>
-#endif
+#include <shared_mutex>
#include <source_location>
#include <span>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream>
-#endif
+#include <sstream>
#include <stack>
-#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
-# include <stdatomic.h>
-#endif
+#include <stdatomic.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdexcept>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <stop_token>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <streambuf>
-#endif
+#include <stop_token>
+#include <streambuf>
#include <string.h>
#include <string>
#include <string_view>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <strstream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <syncstream>
-#endif
+#include <strstream>
+#include <syncstream>
#include <system_error>
#include <tgmath.h>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <thread>
-#endif
+#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
diff --git a/libcxx/modules/std.compat.cppm.in b/libcxx/modules/std.compat.cppm.in
index 0f547a2dc8b715..d743da50ca04f0 100644
--- a/libcxx/modules/std.compat.cppm.in
+++ b/libcxx/modules/std.compat.cppm.in
@@ -24,9 +24,7 @@ module;
#include <cfloat>
#include <cinttypes>
#include <climits>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <clocale>
-#endif
+#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
diff --git a/libcxx/modules/std.cppm.in b/libcxx/modules/std.cppm.in
index ad8a639b7f71a1..4a3cc2d38fc6b3 100644
--- a/libcxx/modules/std.cppm.in
+++ b/libcxx/modules/std.cppm.in
@@ -23,9 +23,7 @@ module;
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <barrier>
-#endif
+#include <barrier>
#include <bit>
#include <bitset>
#include <cassert>
@@ -37,13 +35,9 @@ module;
#include <chrono>
#include <cinttypes>
#include <climits>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <clocale>
-#endif
+#include <clocale>
#include <cmath>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <codecvt>
-#endif
+#include <codecvt>
#include <compare>
#include <complex>
#include <concepts>
@@ -72,36 +66,20 @@ module;
#include <filesystem>
#include <format>
#include <forward_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <fstream>
-#endif
+#include <fstream>
#include <functional>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <future>
-#endif
+#include <future>
#include <initializer_list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iomanip>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ios>
-#endif
+#include <iomanip>
+#include <ios>
#include <iosfwd>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <iostream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <istream>
-#endif
+#include <iostream>
+#include <istream>
#include <iterator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <latch>
-#endif
+#include <latch>
#include <limits>
#include <list>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <locale>
-#endif
+#include <locale>
#include <map>
#include <mdspan>
#include <memory>
@@ -111,50 +89,30 @@ module;
#include <numbers>
#include <numeric>
#include <optional>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <ostream>
-#endif
+#include <ostream>
#include <print>
#include <queue>
#include <random>
#include <ranges>
#include <ratio>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <regex>
-#endif
+#include <regex>
#include <scoped_allocator>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <semaphore>
-#endif
+#include <semaphore>
#include <set>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <shared_mutex>
-#endif
+#include <shared_mutex>
#include <source_location>
#include <span>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <sstream>
-#endif
+#include <sstream>
#include <stack>
#include <stdexcept>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <stop_token>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <streambuf>
-#endif
+#include <stop_token>
+#include <streambuf>
#include <string>
#include <string_view>
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <strstream>
-#endif
-#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
-# include <syncstream>
-#endif
+#include <strstream>
+#include <syncstream>
#include <system_error>
-#if !defined(_LIBCPP_HAS_NO_THREADS)
-# include <thread>
-#endif
+#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
diff --git a/libcxx/utils/libcxx/header_information.py b/libcxx/utils/libcxx/header_information.py
index 166c9a77c08e70..c2b900670d4c93 100644
--- a/libcxx/utils/libcxx/header_information.py
+++ b/libcxx/utils/libcxx/header_information.py
@@ -11,34 +11,6 @@
header_restrictions = {
# headers with #error directives
"atomic": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)",
- "stdatomic.h": "!defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)",
-
- # headers with #error directives
- "ios": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "locale.h": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- # transitive includers of the above headers
- "clocale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "codecvt": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "fstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "iomanip": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "iostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "istream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "locale": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "ostream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "regex": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "sstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "streambuf": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "strstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
- "syncstream": "!defined(_LIBCPP_HAS_NO_LOCALIZATION)",
-
- # headers with #error directives
- "barrier": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "future": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "latch": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "semaphore": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "shared_mutex": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "stop_token": "!defined(_LIBCPP_HAS_NO_THREADS)",
- "thread": "!defined(_LIBCPP_HAS_NO_THREADS)",
# headers with #error directives
"wchar.h": "!defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS)",
|
ldionne
force-pushed
the
review/remove-obsolete-header-restrictions
branch
from
September 10, 2024 14:57
7ae129b
to
c660cf0
Compare
ldionne
changed the title
[libc++] Remove obsolete header restrictions
[libc++] Remove obsolete header restrictions for _LIBCPP_HAS_NO_THREADS
Sep 10, 2024
The _LIBCPP_HAS_NO_THREADS carve-out does not result in hard errors anymore, but the patch that changed that forgot to update the header restrictions we use to auto-generate several files. We can also remove the restrictions for the no-localization build and no-wide-characters, but doing it is less straightforward so I'm leaving it out of this patch.
ldionne
force-pushed
the
review/remove-obsolete-header-restrictions
branch
from
September 10, 2024 15:00
c660cf0
to
0059e30
Compare
VitaNuo
pushed a commit
to VitaNuo/llvm-project
that referenced
this pull request
Sep 12, 2024
…DS (llvm#107437) The _LIBCPP_HAS_NO_THREADS carve-out does not result in hard errors anymore, but the patch that changed that forgot to update the header restrictions we use to auto-generate several files. We can also remove the restrictions for the no-localization build and no-wide-characters, but doing it is less straightforward so I'm leaving it out of this patch.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The _LIBCPP_HAS_NO_THREADS carve-out does not result in hard errors
anymore, but the patch that changed that forgot to update the header
restrictions we use to auto-generate several files.
We can also remove the restrictions for the no-localization build and
no-wide-characters, but doing it is less straightforward so I'm leaving
it out of this patch.