From patchwork Tue Oct 5 16:45:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicola Pero X-Patchwork-Id: 66845 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 0194BB70A6 for ; Wed, 6 Oct 2010 03:45:37 +1100 (EST) Received: (qmail 22645 invoked by alias); 5 Oct 2010 16:45:34 -0000 Received: (qmail 22636 invoked by uid 22791); 5 Oct 2010 16:45:32 -0000 X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (140.186.70.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 05 Oct 2010 16:45:27 +0000 Received: from eggs.gnu.org ([140.186.70.92]:59807) by fencepost.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1P3Ado-0005c5-QK for gcc-patches@gnu.org; Tue, 05 Oct 2010 12:45:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P3Adg-0001k5-Ff for gcc-patches@gnu.org; Tue, 05 Oct 2010 12:45:24 -0400 Received: from smtp241.iad.emailsrvr.com ([207.97.245.241]:47225) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P3Adg-0001ja-AH for gcc-patches@gnu.org; Tue, 05 Oct 2010 12:45:16 -0400 Received: from relay14.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay14.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 8AE8223AA31 for ; Tue, 5 Oct 2010 12:45:15 -0400 (EDT) Received: from dynamic1.wm-web.iad.mlsrvr.com (dynamic1.wm-web.iad.mlsrvr.com [192.168.2.150]) by relay14.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 774D623AA16 for ; Tue, 5 Oct 2010 12:45:13 -0400 (EDT) Received: from meta-innovation.com (localhost [127.0.0.1]) by dynamic1.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 27033C98074 for ; Tue, 5 Oct 2010 12:45:13 -0400 (EDT) Received: by www2.webmail.us (Authenticated sender: nicola.pero@meta-innovation.com, from: nicola.pero@meta-innovation.com) with HTTP; Tue, 5 Oct 2010 18:45:13 +0200 (CEST) Date: Tue, 5 Oct 2010 18:45:13 +0200 (CEST) Subject: ObjC++ bugfix for PR objc++/23707 From: "Nicola Pero" To: "gcc-patches@gnu.org" MIME-Version: 1.0 X-Type: plain Message-ID: <1286297113.156221415@192.168.2.231> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 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 (to be applied on top of the other chunk of ObjC++ bugfixes I sent earlier) fixes PR objc++/23707 (internal compiler error when a method declaration is suddenly interrupted). Ok to apply ? Thanks gcc/cp/ChangeLog: 2010-10-05 Nicola Pero PR objc++/23707 * parser.c (cp_parser_objc_method_keyword_params): If the required colon is not found while parsing parameters, stop parsing them. gcc/testsuite/obj-c++/ChangeLog: 2010-10-05 Nicola Pero PR objc++/23707 * obj-c++.dg/syntax-error.9.mm: New. Index: parser.c =================================================================== --- parser.c (revision 164989) +++ parser.c (working copy) @@ -21482,7 +21491,12 @@ cp_parser_objc_method_keyword_params (cp_parser* p } maybe_unary_selector_p = false; - cp_parser_require (parser, CPP_COLON, RT_COLON); + if (!cp_parser_require (parser, CPP_COLON, RT_COLON)) + { + /* Something went quite wrong. There should be a colon + here, but there is not. Stop parsing parameters. */ + break; + } type_name = cp_parser_objc_typename (parser); /* New ObjC allows attributes on parameters too. */ if (cp_lexer_next_token_is_keyword (parser->lexer, RID_ATTRIBUTE)) Index: obj-c++.dg/syntax-error-9.mm =================================================================== --- obj-c++.dg/syntax-error-9.mm (revision 0) +++ obj-c++.dg/syntax-error-9.mm (revision 0) @@ -0,0 +1,3 @@ +@implementation SaturnDoc /* { dg-warning "cannot find interface declaration" } */ +- read: (void*)aStream ggg /* { dg-error "expected .:. at end of input" } */ +/* { dg-error "expected ..end. at end of input" "" { target *-*-* } 2 } */