This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ PATCH] Only allow __label__ at the beginning of compound statements as documented (PR c++/32121)


On Fri, Sep 28, 2007 at 10:16:13AM -0600, Tom Tromey wrote:
> >>>>> "Jakub" == Jakub Jelinek <jakub@redhat.com> writes:
> 
> Jakub> info gcc on __label__ says:
> 
> Jakub> Local label declarations must come at the beginning of the block,
> Jakub> before any ordinary declarations or statements.
> 
> Is there a reason we want this restriction?  To me it seems more
> "C++-like" to allow label declarations anywhere variable declarations
> are allowed.  I would tend to allow __label__ declarations to be mixed
> with code in C99 mode as well.

Until GCC 3.3 we allowed it only at the beginning of the block even for C++
and it is documented that way.

Anyway, even if it is supposed to be allowed anywhere, I think it should
be always declared before their label, or at least must not result in
allowing silently duplicate labels, as does:
a:;
i = 1;
__label__ a;
a:;
i = 2;
ATM.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]