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 r11-4480] libstdc++: Add comment to nothrow new explaining catch (...) Date: Wed, 28 Oct 2020 13:19:31 +0000 (GMT) [thread overview] Message-ID: <20201028131931.5902A3971C48@sourceware.org> (raw) https://gcc.gnu.org/g:c227d96feb0030d63efad352b8fa7175b4c30721 commit r11-4480-gc227d96feb0030d63efad352b8fa7175b4c30721 Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Oct 28 13:19:21 2020 +0000 libstdc++: Add comment to nothrow new explaining catch (...) The decision to not rethrow a __forced_unwind exception is deliberate, so add a comment explaining it. libstdc++-v3/ChangeLog: * libsupc++/new_opnt.cc (new): Add comment about forced unwind exceptions. Diff: --- libstdc++-v3/libsupc++/new_opnt.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/libsupc++/new_opnt.cc b/libstdc++-v3/libsupc++/new_opnt.cc index ace4e6f9345..0e5e39ab994 100644 --- a/libstdc++-v3/libsupc++/new_opnt.cc +++ b/libstdc++-v3/libsupc++/new_opnt.cc @@ -26,9 +26,6 @@ #include <bits/exception_defines.h> #include "new" -using std::new_handler; -using std::bad_alloc; - extern "C" void *malloc (std::size_t); _GLIBCXX_WEAK_DEFINITION void * @@ -43,6 +40,13 @@ operator new (std::size_t sz, const std::nothrow_t&) noexcept } __catch (...) { + // N.B. catch (...) means the process will terminate if operator new(sz) + // exits with a __forced_unwind exception. The process will print + // "FATAL: exception not rethrown" to stderr before exiting. + // + // If we propagated that exception the process would still terminate + // (because this function is noexcept) but with a less informative error: + // "terminate called without active exception". return nullptr; } }
reply other threads:[~2020-10-28 13:19 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=20201028131931.5902A3971C48@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).