From patchwork Wed Sep 1 04:35:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 63348 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 50C0CB715A for ; Wed, 1 Sep 2010 14:35:58 +1000 (EST) Received: (qmail 872 invoked by alias); 1 Sep 2010 04:35:54 -0000 Received: (qmail 863 invoked by uid 22791); 1 Sep 2010 04:35:52 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, TW_CC, T_RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.35) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 01 Sep 2010 04:35:46 +0000 Received: from hpaq13.eem.corp.google.com (hpaq13.eem.corp.google.com [172.25.149.13]) by smtp-out.google.com with ESMTP id o814Zijh018491 for ; Tue, 31 Aug 2010 21:35:44 -0700 Received: from pzk30 (pzk30.prod.google.com [10.243.19.158]) by hpaq13.eem.corp.google.com with ESMTP id o814Zgu6002501 for ; Tue, 31 Aug 2010 21:35:43 -0700 Received: by pzk30 with SMTP id 30so2069081pzk.29 for ; Tue, 31 Aug 2010 21:35:41 -0700 (PDT) Received: by 10.114.120.4 with SMTP id s4mr8068366wac.212.1283315739084; Tue, 31 Aug 2010 21:35:39 -0700 (PDT) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id k23sm17744370waf.17.2010.08.31.21.35.37 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 21:35:38 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Better error message for missing statement after label Date: Tue, 31 Aug 2010 21:35:35 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org This patch improves gccgo's error message and subsequent processing when a statement is missing after a label. Committed to gccgo branch. Ian diff -r 5052eefabc12 go/parse.cc --- a/go/parse.cc Tue Aug 31 20:07:09 2010 -0700 +++ b/go/parse.cc Tue Aug 31 21:34:26 2010 -0700 @@ -3072,6 +3072,14 @@ return; } + if (!this->statement_may_start_here()) + { + error_at(location, "missing statement after label"); + this->unget_token(Token::make_operator_token(OPERATOR_SEMICOLON, + location)); + return; + } + this->statement(label); }