]> gcc.gnu.org Git - gcc.git/commitdiff
libstdc++: Do not include <system_error> in concurrency headers
authorJonathan Wakely <jwakely@redhat.com>
Thu, 12 Jan 2023 13:03:01 +0000 (13:03 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 13 Jan 2023 00:15:01 +0000 (00:15 +0000)
The <condition_variable>, <mutex>, and <shared_mutex> headers use
std::errc constants, but don't use std::system_error itself. They only
use the __throw_system_error(int) function, which is defined in
<bits/functexcept.h>.

By including the header for the errc constants instead of the whole of
<system_error> we avoid depending on the whole std::string definition.

libstdc++-v3/ChangeLog:

* include/bits/std_mutex.h: Remove <system_error> include.
* include/std/condition_variable: Add <bits/error_constants.h>
include.
* include/std/mutex: Likewise.
* include/std/shared_mutex: Likewise.

libstdc++-v3/include/bits/std_mutex.h
libstdc++-v3/include/std/condition_variable
libstdc++-v3/include/std/mutex
libstdc++-v3/include/std/shared_mutex

index 68f5fb9ed65bc663cbc7e0155da51dff669ed8c1..bc515358d23bde0c659a3f1122fba332390e4c1c 100644 (file)
@@ -36,7 +36,6 @@
 # include <bits/c++0x_warning.h>
 #else
 
-#include <system_error>
 #include <bits/functexcept.h>
 #include <bits/gthr.h>
 
index b885e1baa1b61090097fd2692789250597ab218f..f671fe4afe1c9455c6cde56bdd5b899335e93d56 100644 (file)
@@ -38,6 +38,7 @@
 #else
 
 #include <bits/chrono.h>
+#include <bits/error_constants.h>
 #include <bits/std_mutex.h>
 #include <bits/unique_lock.h>
 #include <bits/alloc_traits.h>
@@ -372,7 +373,7 @@ _GLIBCXX_BEGIN_INLINE_ABI_NAMESPACE(_V2)
         {
           return __p();
         }
+
       std::stop_callback __cb(__stoken, [this] { notify_all(); });
       shared_ptr<mutex> __mutex = _M_mutex;
       while (!__p())
index aca5f91e03c636e5d04e63ff507af34ff1ce2b25..4eedbe5038ce0c5279b2fca447e1b7442f88f549 100644 (file)
@@ -40,8 +40,8 @@
 #include <tuple>
 #include <exception>
 #include <type_traits>
-#include <system_error>
 #include <bits/chrono.h>
+#include <bits/error_constants.h>
 #include <bits/std_mutex.h>
 #include <bits/unique_lock.h>
 #if ! _GTHREAD_USE_MUTEX_TIMEDLOCK
index 7b70697f1785606ceda444f0a37657c30918011c..57c3cc54d81cdef660b30cc1b4bb8d9fb7214add 100644 (file)
@@ -36,6 +36,7 @@
 #if __cplusplus >= 201402L
 
 #include <bits/chrono.h>
+#include <bits/error_constants.h>
 #include <bits/functexcept.h>
 #include <bits/move.h>        // move, __exchange
 #include <bits/std_mutex.h>   // defer_lock_t
This page took 0.060808 seconds and 5 git commands to generate.