-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[libc++] Granularize <mutex> includes #117068
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
Merged
Merged
Conversation
This file contains hidden or 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
0d1e860
to
23af5be
Compare
@llvm/pr-subscribers-libcxx Author: Nikolas Klauser (philnik777) ChangesFull diff: https://github.com/llvm/llvm-project/pull/117068.diff 6 Files Affected:
diff --git a/libcxx/include/__memory_resource/synchronized_pool_resource.h b/libcxx/include/__memory_resource/synchronized_pool_resource.h
index 6384564afc917a..bcc1ac4a172e3a 100644
--- a/libcxx/include/__memory_resource/synchronized_pool_resource.h
+++ b/libcxx/include/__memory_resource/synchronized_pool_resource.h
@@ -10,10 +10,12 @@
#define _LIBCPP___MEMORY_RESOURCE_SYNCHRONIZED_POOL_RESOURCE_H
#include <__config>
+#include <__cstddef/size_t.h>
#include <__memory_resource/memory_resource.h>
#include <__memory_resource/pool_options.h>
#include <__memory_resource/unsynchronized_pool_resource.h>
-#include <mutex>
+#include <__mutex/mutex.h>
+#include <__mutex/unique_lock.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
# pragma GCC system_header
diff --git a/libcxx/include/future b/libcxx/include/future
index cbf3ed93464176..5b2e9eed88e358 100644
--- a/libcxx/include/future
+++ b/libcxx/include/future
@@ -368,6 +368,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
# include <__assert>
# include <__chrono/duration.h>
+# include <__chrono/steady_clock.h>
# include <__chrono/time_point.h>
# include <__condition_variable/condition_variable.h>
# include <__exception/exception_ptr.h>
@@ -381,6 +382,9 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
# include <__memory/shared_count.h>
# include <__memory/unique_ptr.h>
# include <__memory/uses_allocator.h>
+# include <__mutex/lock_guard.h>
+# include <__mutex/mutex.h>
+# include <__mutex/unique_lock.h>
# include <__system_error/error_category.h>
# include <__system_error/error_code.h>
# include <__system_error/error_condition.h>
@@ -390,14 +394,19 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
# include <__type_traits/conditional.h>
# include <__type_traits/decay.h>
# include <__type_traits/enable_if.h>
+# include <__type_traits/invoke.h>
+# include <__type_traits/is_same.h>
+# include <__type_traits/remove_cvref.h>
+# include <__type_traits/remove_reference.h>
# include <__type_traits/strip_signature.h>
# include <__type_traits/underlying_type.h>
# include <__utility/auto_cast.h>
# include <__utility/forward.h>
# include <__utility/move.h>
-# include <mutex>
+# include <__utility/swap.h>
# include <new>
# include <stdexcept>
+# include <tuple>
# include <version>
# if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
diff --git a/libcxx/include/memory_resource b/libcxx/include/memory_resource
index 7de69e67b7c062..e54b7e6e2473fe 100644
--- a/libcxx/include/memory_resource
+++ b/libcxx/include/memory_resource
@@ -66,6 +66,10 @@ namespace std::pmr {
# pragma GCC system_header
#endif
+#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER >= 17 && _LIBCPP_STD_VER <= 20
+# include <mutex>
+#endif
+
#if !defined(_LIBCPP_REMOVE_TRANSITIVE_INCLUDES) && _LIBCPP_STD_VER <= 20
# include <stdexcept>
#endif
diff --git a/libcxx/include/syncstream b/libcxx/include/syncstream
index 970706976e1ff1..2699a4b3a6fbbd 100644
--- a/libcxx/include/syncstream
+++ b/libcxx/include/syncstream
@@ -121,6 +121,7 @@ namespace std {
#if _LIBCPP_HAS_LOCALIZATION
+# include <__mutex/lock_guard.h>
# include <__utility/move.h>
# include <ios>
# include <iosfwd> // required for declaration of default arguments
@@ -129,7 +130,6 @@ namespace std {
# if _LIBCPP_HAS_THREADS
# include <map>
-# include <mutex>
# include <shared_mutex>
# endif
diff --git a/libcxx/test/libcxx/transitive_includes/cxx23.csv b/libcxx/test/libcxx/transitive_includes/cxx23.csv
index a008b4d76edde6..096c321672474d 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx23.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx23.csv
@@ -465,7 +465,6 @@ future iosfwd
future istream
future limits
future locale
-future mutex
future new
future ratio
future sstream
@@ -692,11 +691,9 @@ memory_resource compare
memory_resource cstdint
memory_resource ctime
memory_resource limits
-memory_resource mutex
memory_resource new
memory_resource ratio
memory_resource tuple
-memory_resource typeinfo
memory_resource version
mutex cerrno
mutex climits
@@ -1076,7 +1073,6 @@ syncstream iosfwd
syncstream limits
syncstream locale
syncstream map
-syncstream mutex
syncstream new
syncstream optional
syncstream ostream
diff --git a/libcxx/test/libcxx/transitive_includes/cxx26.csv b/libcxx/test/libcxx/transitive_includes/cxx26.csv
index d5321da32b3d46..74d912e5fe3a31 100644
--- a/libcxx/test/libcxx/transitive_includes/cxx26.csv
+++ b/libcxx/test/libcxx/transitive_includes/cxx26.csv
@@ -464,7 +464,6 @@ future iosfwd
future istream
future limits
future locale
-future mutex
future new
future ratio
future sstream
@@ -691,11 +690,9 @@ memory_resource compare
memory_resource cstdint
memory_resource ctime
memory_resource limits
-memory_resource mutex
memory_resource new
memory_resource ratio
memory_resource tuple
-memory_resource typeinfo
memory_resource version
mutex cerrno
mutex climits
@@ -1075,7 +1072,6 @@ syncstream iosfwd
syncstream limits
syncstream locale
syncstream map
-syncstream mutex
syncstream new
syncstream optional
syncstream ostream
|
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.
No description provided.