This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR vs TRY_CATCH_EXPR
- To: kenner at vlsi1 dot ultra dot nyu dot edu
- Subject: Re: CLEANUP_POINT_EXPR/WITH_CLEANUP_EXPR vs TRY_CATCH_EXPR
- From: mrs at wrs dot com (Mike Stump)
- Date: Fri, 18 Dec 1998 17:10:09 -0800
- Cc: egcs at cygnus dot com, gcc2 at cygnus dot com
> Date: Fri, 18 Dec 98 19:40:43 EST
> From: kenner@vlsi1.ultra.nyu.edu (Richard Kenner)
> Unless they add the single line call to tell the core compiler that
> they are EH-aware.
Yes, but why should they? Imagine n new languages and 2 old
languages. If n is > 2, it is more work. I hope we have more than
two new languages. Java appears to be 1 (if Per confirms this is why
we was misled).
> > Why change a default and require front ends to change because of it?
> Because it is what is best, it is what is natural and it is what is
> either explicitly stated or implied in the documentation.
> I disagree.
Could you state why. I have tried to support my position. To quote
the documentation:
/* CLEANUP is an expression to be executed at exit from this binding contour;
for example, in C++, it might call the destructor for this variable.
We wrap CLEANUP in an UNSAVE_EXPR node, so that we can expand the
CLEANUP multiple times, and have the correct semantics. This
happens in exception handling, for gotos, returns, breaks that
leave the current scope.
int
expand_decl_cleanup (decl, cleanup)
tree decl, cleanup;
Now, we can argue what it means to exit the binding contour. Feel
free to say that if we leave it via an exception, we don't really
leave it... I'm not ever going to accept that.
> There is no code to handle cleanups in the Ada front end;
I think there is a miscommunication. In expand_decl_cleanup type of
things, which seem to be used by the Ada front end, else there
wouldn't be a need for this flag, those actions are what I refer to
when I say cleanup. Upon an exception I think the Ada spec says these
actions are performed in a certain order and so on when an exception
happens. In order for them to happen, you walk a list at run time and
perform actions off the list. This is the code I refer to. This is
as I recall handled by the Ada front end. Maybe they only express
themselves in the language under the guise of exception handling (try
finally)?
After the Ada front end is converted, you will understand what I meant
by replicated code.