]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Do not include <exception> in <mutex>
authorJonathan Wakely <jwakely@redhat.com>
Wed, 31 May 2023 10:34:19 +0000 (11:34 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 31 May 2023 12:17:46 +0000 (13:17 +0100)
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.

libstdc++-v3/include/bits/unique_lock.h
libstdc++-v3/include/std/mutex

index f14674ed471abaa3603a7ebbaed8ef1b28ce9b05..c28e6456ad5e37fe6742e4917b68cb2d48275d9e 100644 (file)
@@ -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
 
index 79420388abc51c5bb7f469966113dc4ec3b7df93..2b0059fcfe898f941490f3ec10c5d813506d709e 100644 (file)
 # 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