public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "david daney" <ddaney@avtrex.com>
To: "Stelios Xanthakis" <sxanth@ceid.upatras.gr>,
	"Richard Henderson" <rth@redhat.com>
Cc: <gcc@gcc.gnu.org>
Subject: RE: Using EH from C
Date: Sun, 02 May 2004 04:39:00 -0000	[thread overview]
Message-ID: <69397FFCADEFD94F8D5A0FC0FDBCBBDEF417@avtrex-server.hq.avtrex.com> (raw)

On Sat, 1 May 2004, Richard Henderson wrote:

>> On Sat, May 01, 2004 at 05:09:23PM +0300, Stelios Xanthakis wrote:
>> > But of little use without another extension to create landing pads...:(
>>
>> Why in the world would you need that?

>Because if there's no landing pad, _Unwind_RaiseException
>ends up on abort()?
>
>I may be totally wrong, but what I'm trying to do is implement
>"stack unwind with cost-free cleanups from C".
>
>That's three things
>
>1. register destructors on EH
>  Done: attribute(cleanup(function))
>
>2. call 'throw'
>  Done: libgcc_eh and unwind.h
>
>3. set up a landing pad somewhere (try-catch).
>  ???
>
>Where does _Unwind stop otherwise? main()?
>
>~S


gcc/testsuite/gcc.dg/cleanup9.c kind of does what you are talking about.  I would setjump and set an attfibute(cleanup(function)) at the catch point, and then longjump from the cleanup function.
 
Why can't you use C++ for the try/catch part?  Since all of this is GCC specific, if you have C and excpetions working it doesn't seem like using G++ would be a problem.
 
David Daney.
 

             reply	other threads:[~2004-05-02  4:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-02  4:39 david daney [this message]
2004-05-02  9:17 ` Stelios Xanthakis
2004-05-03 11:18   ` Stelios Xanthakis
2004-05-03 16:32     ` Richard Henderson
  -- strict thread matches above, loose matches on Subject: below --
2004-04-29 12:51 Stelios Xanthakis
2004-04-29 22:46 ` Richard Henderson
2004-04-30  2:35   ` Giovanni Bajo
2004-04-30  3:15     ` Richard Henderson
2004-04-30  3:36       ` Mike Stump
2004-04-30 16:10   ` Stelios Xanthakis
2004-05-01 14:09     ` Stelios Xanthakis
2004-05-01 18:13       ` Richard Henderson
2004-05-02  2:12         ` Stelios Xanthakis

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=69397FFCADEFD94F8D5A0FC0FDBCBBDEF417@avtrex-server.hq.avtrex.com \
    --to=ddaney@avtrex.com \
    --cc=gcc@gcc.gnu.org \
    --cc=rth@redhat.com \
    --cc=sxanth@ceid.upatras.gr \
    /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).