From: Paolo Carlini <pcarlini@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [C++ Patch] PR 32108
Date: Thu, 12 Jul 2007 11:30:00 -0000 [thread overview]
Message-ID: <46960B4C.6070407@suse.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 449 bytes --]
Hi,
the issue here seems indeed rather simple. I'm only slightly nervous
about the semantics of 'at_function_scope_p' exactly matching the
documentation, which talks about "GCC allows you to declare local labels
in any nested block scope". Otherwise, with the minimal patch the
testcase is rejected consistently with the C front-end and issuing a
consistent error message.
Tested x86_64-linux. Ok mainline and 4_2-branch?
Paolo.
///////////////
[-- Attachment #2: CL_32108 --]
[-- Type: text/plain, Size: 267 bytes --]
cp/
2007-07-12 Paolo Carlini <pcarlini@suse.de>
PR c++/32108
* parser.c (cp_parser_block_declaration): Reject the
__label__ extension outside function-scope.
testsuite/
2007-07-12 Paolo Carlini <pcarlini@suse.de>
PR c++/32108
* g++.dg/ext/label6.C: New.
[-- Attachment #3: patch_32108 --]
[-- Type: text/plain, Size: 1083 bytes --]
Index: testsuite/g++.dg/ext/label6.C
===================================================================
*** testsuite/g++.dg/ext/label6.C (revision 0)
--- testsuite/g++.dg/ext/label6.C (revision 0)
***************
*** 0 ****
--- 1,3 ----
+ // PR c++/32108
+
+ __label__ L; // { dg-error "before" }
Index: cp/parser.c
===================================================================
*** cp/parser.c (revision 126546)
--- cp/parser.c (working copy)
*************** cp_parser_block_declaration (cp_parser *
*** 7747,7753 ****
/*access_declaration_p=*/false);
}
/* If the next keyword is `__label__' we have a label declaration. */
! else if (token1->keyword == RID_LABEL)
{
if (statement_p)
cp_parser_commit_to_tentative_parse (parser);
--- 7747,7754 ----
/*access_declaration_p=*/false);
}
/* If the next keyword is `__label__' we have a label declaration. */
! else if (token1->keyword == RID_LABEL
! && at_function_scope_p ())
{
if (statement_p)
cp_parser_commit_to_tentative_parse (parser);
next reply other threads:[~2007-07-12 11:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-12 11:30 Paolo Carlini [this message]
2007-07-17 4:39 ` Mark Mitchell
2007-07-25 11:15 ` Paolo Carlini
2007-07-26 23:09 ` Mark Mitchell
2007-07-26 23:17 ` Paolo Carlini
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=46960B4C.6070407@suse.de \
--to=pcarlini@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/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).