public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Iain Sandoe <iain@sandoe.co.uk>
To: Jonathan Wakely <jwakely@redhat.com>
Cc: libstdc++@gcc.gnu.org
Subject: Re: 18_support/nested_exception/rethrow_if_nested-term.cc
Date: Sun, 20 Aug 2023 14:01:35 +0100	[thread overview]
Message-ID: <5E303765-CCB8-4AC3-B757-3B3DAB44A675@sandoe.co.uk> (raw)
In-Reply-To: <CACb0b4nSWaO5q_uvWgY5uvt_TQzEj4PshQJSoSHtJmxDN+++UQ@mail.gmail.com>

Hi Jonathan,

> On 20 Aug 2023, at 12:21, Jonathan Wakely <jwakely@redhat.com> wrote:
> 
> On Sun, 20 Aug 2023 at 11:08, Iain Sandoe <iain@sandoe.co.uk> wrote:

> 
>> So, ISTM that the difference is not in the actual nested exception handling (including the conditional rethrow) but lies, instead in a different interpretation of when the changes from set_terminate() take effect.
> 
> I don't think it's when the changes take effect, that has to be
> instant (i.e. get_terminate() must return the new handler
> immediately). It's whether std::terminate() actually uses the result
> of std::get_terminate() or uses the active exception's stored handler.

It would seem the latter (but I did not read the code so far).

>> — it needs someone with state on the history of this to comment …
>> 
>> a) does that seem like a reasonable analysis?
>> b) would it be acceptable to move the set_terminate () call?
> 
> I didn't intend this test to depend on unspecified behaviour. But just
> moving it before the throw would mean that if std::throw_with_nested
> terminates for some reason, we would exit cleanly and the test would
> pass, which we don't want.

right.

> I would prefer the attached change instead. I assume this works with
> both runtimes?
> (This also gives a FAIL if throw_with_nested returns normally for some
> reason, which would also currently PASS.)

Yes, it works with GCC (supc++) clang (main at least) and GCC (c++abi WIP)
thanks
Iain


  reply	other threads:[~2023-08-20 13:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-20 10:08 18_support/nested_exception/rethrow_if_nested-term.cc Iain Sandoe
2023-08-20 11:21 ` 18_support/nested_exception/rethrow_if_nested-term.cc Jonathan Wakely
2023-08-20 13:01   ` Iain Sandoe [this message]
2023-08-20 13:33     ` 18_support/nested_exception/rethrow_if_nested-term.cc Jonathan Wakely

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=5E303765-CCB8-4AC3-B757-3B3DAB44A675@sandoe.co.uk \
    --to=iain@sandoe.co.uk \
    --cc=jwakely@redhat.com \
    --cc=libstdc++@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: link
Be 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).