From patchwork Fri Sep 10 18:42:13 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: 64444 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 180B6B6EEF for ; Sat, 11 Sep 2010 04:42:30 +1000 (EST) Received: (qmail 17869 invoked by alias); 10 Sep 2010 18:42:27 -0000 Received: (qmail 17860 invoked by uid 22791); 10 Sep 2010 18:42:27 -0000 X-SWARE-Spam-Status: No, hits=-2.0 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; Fri, 10 Sep 2010 18:42:20 +0000 Received: from kpbe12.cbf.corp.google.com (kpbe12.cbf.corp.google.com [172.25.105.76]) by smtp-out.google.com with ESMTP id o8AIgHk0009553 for ; Fri, 10 Sep 2010 11:42:17 -0700 Received: from pxi6 (pxi6.prod.google.com [10.243.27.6]) by kpbe12.cbf.corp.google.com with ESMTP id o8AIgFX1017655 for ; Fri, 10 Sep 2010 11:42:15 -0700 Received: by pxi6 with SMTP id 6so1385087pxi.31 for ; Fri, 10 Sep 2010 11:42:15 -0700 (PDT) Received: by 10.142.48.1 with SMTP id v1mr1180397wfv.1.1284144135457; Fri, 10 Sep 2010 11:42:15 -0700 (PDT) Received: from coign.google.com (dhcp-172-22-123-203.mtv.corp.google.com [172.22.123.203]) by mx.google.com with ESMTPS id l41sm3463600wfa.13.2010.09.10.11.42.14 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 10 Sep 2010 11:42:14 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Better error recover after top level declaration Date: Fri, 10 Sep 2010 11:42:13 -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 gccgo patch improves error recovery when something goes wrong after a top level declaration. Committed to gccgo branch. Ian diff -r b59226aea9d4 go/parse.cc --- a/go/parse.cc Thu Sep 09 22:12:54 2010 -0700 +++ b/go/parse.cc Fri Sep 10 11:40:58 2010 -0700 @@ -4613,7 +4613,10 @@ if (token->is_op(OPERATOR_SEMICOLON)) token = this->advance_token(); else if (!token->is_eof() || !saw_errors()) - this->error("expected %<;%> or newline after top level declaration"); + { + this->error("expected %<;%> or newline after top level declaration"); + this->skip_past_error(OPERATOR_INVALID); + } } }