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 r10-9585] libstdc++: Fix bootstrap with -fno-rtti [PR 99077] Date: Mon, 29 Mar 2021 20:02:40 +0000 (GMT) [thread overview] Message-ID: <20210329200240.2575F3850431@sourceware.org> (raw) https://gcc.gnu.org/g:1d5d30410655f21bdeee6c5f2fd970247eea4d23 commit r10-9585-g1d5d30410655f21bdeee6c5f2fd970247eea4d23 Author: Jonathan Wakely <jwakely@redhat.com> Date: Fri Feb 12 10:37:56 2021 +0000 libstdc++: Fix bootstrap with -fno-rtti [PR 99077] When libstdc++ is built without RTTI the __ios_failure type is just an alias for std::ios_failure, so trying to construct it from an int won't compile. This changes the RTTI-enabled __ios_failure type to have the same constructor parameters as std::ios_failure, so that the constructor takes the same arguments whether RTTI is enabled or not. The __throw_ios_failure function now constructs the error_code, instead of the __ios_failure constructor. As a drive-by fix that error_code is constructed with std::generic_category() not std::system_category(), because the int comes from errno which corresponds to the generic category. libstdc++-v3/ChangeLog: PR libstdc++/99077 * src/c++11/cxx11-ios_failure.cc (__ios_failure(const char*, int)): Change int parameter to error_code, to match std::ios_failure. (__throw_ios_failure(const char*, int)): Construct error_code from int parameter. (cherry picked from commit 4591f7e5329dcc6ee9af2f314a050936d470ab5b) Diff: --- libstdc++-v3/src/c++11/cxx11-ios_failure.cc | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc index 522573e3381..4339389c35f 100644 --- a/libstdc++-v3/src/c++11/cxx11-ios_failure.cc +++ b/libstdc++-v3/src/c++11/cxx11-ios_failure.cc @@ -114,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __ios_failure(const char* s) : failure(s) { __construct_ios_failure(buf, runtime_error::what()); } - __ios_failure(const char* s, int e) : failure(s, to_error_code(e)) + __ios_failure(const char* s, const error_code& e) : failure(s, e) { __construct_ios_failure(buf, runtime_error::what()); } ~__ios_failure() @@ -125,10 +125,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // There are assertions in src/c++98/ios_failure.cc to ensure the size // and alignment assumptions are valid. alignas(runtime_error) unsigned char buf[sizeof(runtime_error)]; - - static error_code - to_error_code(int e) - { return e ? error_code(e, system_category()) : io_errc::stream; } }; // Custom type info for __ios_failure. @@ -171,7 +167,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION void __throw_ios_failure(const char* str __attribute__((unused)), int err __attribute__((unused))) - { _GLIBCXX_THROW_OR_ABORT(__ios_failure(_(str), err)); } + { + _GLIBCXX_THROW_OR_ABORT(__ios_failure(_(str), + err ? error_code(err, generic_category()) : io_errc::stream)); + } _GLIBCXX_END_NAMESPACE_VERSION } // namespace
reply other threads:[~2021-03-29 20:02 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=20210329200240.2575F3850431@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).