aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-05-31 11:34:19 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-05-31 13:17:46 +0100
commit5a07b3b8bb9ce20849d6269e1601ead0ad3b8f75 (patch)
tree140ecfa8d7e764b78d1f790a4f29932f4afe6063
parent0ed5259ccbd66d190365ab33b05ad5879263a623 (diff)
downloadgcc-5a07b3b8bb9ce20849d6269e1601ead0ad3b8f75.zip
gcc-5a07b3b8bb9ce20849d6269e1601ead0ad3b8f75.tar.gz
gcc-5a07b3b8bb9ce20849d6269e1601ead0ad3b8f75.tar.bz2
libstdc++: Do not include <exception> in <mutex>
We previously needed <exception> in <mutex> for the std::lock_error exception class, but that was moved out of <mutex> in 2009 when it was removed from the C++0x draft. We can stop including <exception> now. Move the include for <bits/error_constants.h> to <bits/unique_lock.h> where it's actually used, and only include <errno.h> in <mutex> (for EAGAIN and EDEADLK). Also add some headers to <mutex> that are needed but are not included directly: <bits/functexcept.h>, <bits/invoke.h> and <bits/move.h>. libstdc++-v3/ChangeLog: * include/bits/unique_lock.h: Include <bits/error_constants.h> here for std::errc constants. * include/std/mutex: Do not include <bits/error_constants.h> and <exception> here.
-rw-r--r--libstdc++-v3/include/bits/unique_lock.h1
-rw-r--r--libstdc++-v3/include/std/mutex12
2 files changed, 8 insertions, 5 deletions
diff --git a/libstdc++-v3/include/bits/unique_lock.h b/libstdc++-v3/include/bits/unique_lock.h
index f14674e..c28e645 100644
--- a/libstdc++-v3/include/bits/unique_lock.h
+++ b/libstdc++-v3/include/bits/unique_lock.h
@@ -37,6 +37,7 @@
#else
#include <bits/chrono.h>
+#include <bits/error_constants.h> // for std::errc
#include <bits/move.h> // for std::swap
#include <bits/std_mutex.h> // for std::defer_lock_t
diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex
index 7942038..2b0059f 100644
--- a/libstdc++-v3/include/std/mutex
+++ b/libstdc++-v3/include/std/mutex
@@ -37,11 +37,13 @@
# include <bits/c++0x_warning.h>
#else
-#include <tuple>
-#include <exception>
-#include <type_traits>
-#include <bits/chrono.h>
-#include <bits/error_constants.h>
+#include <tuple> // std::tuple
+#include <type_traits> // is_same_v
+#include <errno.h> // EAGAIN, EDEADLK
+#include <bits/chrono.h> // duration, time_point, is_clock_v
+#include <bits/functexcept.h> // __throw_system_error
+#include <bits/invoke.h> // __invoke
+#include <bits/move.h> // std::forward
#include <bits/std_mutex.h>
#include <bits/unique_lock.h>
#if ! _GTHREAD_USE_MUTEX_TIMEDLOCK