This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Only allow __label__ at the beginning of compound statements as documented (PR c++/32121)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 28 Sep 2007 13:01:43 -0400
- Subject: Re: [C++ PATCH] Only allow __label__ at the beginning of compound statements as documented (PR c++/32121)
- References: <20070927140718.GS2625@devserv.devel.redhat.com> <m34phesr3m.fsf@fleche.redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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