C++: Tag transparent binding contour

Mark Mitchell mark@codesourcery.com
Fri Sep 19 20:07:00 GMT 2003


On Fri, 2003-09-19 at 12:40, Jason Merrill wrote:
> On 19 Sep 2003 11:49:17 -0700, Mark Mitchell <mark@codesourcery.com> wrote:
> 
> > On Fri, 2003-09-19 at 11:23, Jason Merrill wrote:
> >> On Fri, 19 Sep 2003 01:47:24 -0700, "Mark Mitchell" <mark@codesourcery.com> wrote:
> >> 
> >> >> Thanks. Do you have a suggestion for dealing with the (pseudo-)scope
> >> > created
> >> >> for EH purposes?  If I understand Jason correctly, we need a region to
> >> >> contain only EH stuff and no names.  sk_cleanup (following Jason's
> >> >> previous adice) seems to work -- but I agree with you that it would be
> >> >> nicer if we didn't need it.
> >> >
> >> > We've lived with this wart for a long time; we can live with it a while
> >> > longer.  So, I don't object to sk_cleanup; it's no worse than what we have
> >> > now.
> >> >
> >> > I'm not sure exactly what the reason for the EH is.   I think I used to
> >> > understand this, but I do not understand any more.  Perhaps Jason can
> >> > explain it.
> >> 
> >> It isn't EH-specific, actually; it's necessary for cleanups in general.
> >> Running cleanups is handled by the binding contour code in stmt.c.
> >> 
> >>   struct A { ~A(); };
> >> 
> >>   void f ()
> >>   {
> >>     A a1;
> >>    label:
> >>     A a2;
> >> 
> >>     ...
> >>   }
> >
> > Can you go into more detail?  How does the label effect anything about
> > cleanups?
> 
> A "goto label" from within the scope of a2 must destroy a2 but not a1.

OK, good, that's what I was forgetting.

It seems like this could be handled during the creation of RTL, without
actually affecting the C++ binding_level/scope structures.  In other
words, create the SCOPE_STMTs, but not the binding levels.

-- 
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com



More information about the Gcc mailing list