public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r13-5131] libstdc++: Do not include <system_error> in concurrency headers Date: Fri, 13 Jan 2023 00:15:26 +0000 (GMT) [thread overview] Message-ID: <20230113001526.0FE3438543BA@sourceware.org> (raw) https://gcc.gnu.org/g:227351345d0caa596eff8325144f15b15f704c08 commit r13-5131-g227351345d0caa596eff8325144f15b15f704c08 Author: Jonathan Wakely <jwakely@redhat.com> Date: Thu Jan 12 13:03:01 2023 +0000 libstdc++: Do not include <system_error> in concurrency headers 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. Diff: --- libstdc++-v3/include/bits/std_mutex.h | 1 - libstdc++-v3/include/std/condition_variable | 3 ++- libstdc++-v3/include/std/mutex | 2 +- libstdc++-v3/include/std/shared_mutex | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h index 68f5fb9ed65..bc515358d23 100644 --- a/libstdc++-v3/include/bits/std_mutex.h +++ b/libstdc++-v3/include/bits/std_mutex.h @@ -36,7 +36,6 @@ # include <bits/c++0x_warning.h> #else -#include <system_error> #include <bits/functexcept.h> #include <bits/gthr.h> diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index b885e1baa1b..f671fe4afe1 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -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()) diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index aca5f91e03c..4eedbe5038c 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -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 diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index 7b70697f178..57c3cc54d81 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -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
reply other threads:[~2023-01-13 0:15 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230113001526.0FE3438543BA@sourceware.org \ --to=redi@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).