From patchwork Tue Aug 31 21:15:02 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: 63319 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 810A9B7141 for ; Wed, 1 Sep 2010 07:15:23 +1000 (EST) Received: (qmail 26649 invoked by alias); 31 Aug 2010 21:15:22 -0000 Received: (qmail 26637 invoked by uid 22791); 31 Aug 2010 21:15:21 -0000 X-SWARE-Spam-Status: No, hits=-2.3 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) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 31 Aug 2010 21:15:17 +0000 Received: from hpaq3.eem.corp.google.com (hpaq3.eem.corp.google.com [172.25.149.3]) by smtp-out.google.com with ESMTP id o7VLFAKZ024397 for ; Tue, 31 Aug 2010 14:15:10 -0700 Received: from ywo32 (ywo32.prod.google.com [10.192.15.32]) by hpaq3.eem.corp.google.com with ESMTP id o7VLEku5031566 for ; Tue, 31 Aug 2010 14:15:08 -0700 Received: by ywo32 with SMTP id 32so4000795ywo.11 for ; Tue, 31 Aug 2010 14:15:07 -0700 (PDT) Received: by 10.101.204.1 with SMTP id g1mr7147894anq.243.1283289305400; Tue, 31 Aug 2010 14:15:05 -0700 (PDT) Received: from coign.google.com (dhcp-172-22-124-178.mtv.corp.google.com [172.22.124.178]) by mx.google.com with ESMTPS id u14sm15268187ann.20.2010.08.31.14.15.04 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 31 Aug 2010 14:15:04 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: [gccgo] Expect a type after an erroneous ellipsis Date: Tue, 31 Aug 2010 14:15:02 -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 A type will normally follow an ellipsis in a function definition. When an ellipsis is erroneously used with two parameters, the code was not looking for the type. This caused it spew some useless error messages. This patch makes it look for the type. Committed to gccgo branch. Ian Index: gcc/go/parse.cc =================================================================== --- gcc/go/parse.cc (revision 163575) +++ gcc/go/parse.cc (working copy) @@ -818,7 +818,7 @@ Parse::parameter_list(bool* is_varargs) { this->error("%<...%> only permits one name"); this->advance_token(); - type = Type::make_error_type(); + type = this->type(); } for (size_t i = 0; i < ret->size(); ++i) ret->set_type(i, type); Index: gcc/testsuite/go.test/test/fixedbugs/bug228.go =================================================================== --- gcc/testsuite/go.test/test/fixedbugs/bug228.go (revision 163682) +++ gcc/testsuite/go.test/test/fixedbugs/bug228.go (working copy) @@ -6,14 +6,14 @@ package main -func f(x int, y ...) // ok +func f(x int, y ...int) // ok func g(x int, y float) (...) // ERROR "[.][.][.]" -func h(x, y ...) // ERROR "[.][.][.]" +func h(x, y ...int) // ERROR "[.][.][.]" -func i(x int, y ..., z float) // ERROR "[.][.][.]" +func i(x int, y ...int, z float) // ERROR "[.][.][.]" -var x ...; // ERROR "[.][.][.]|syntax|type" +var x ...int; // ERROR "[.][.][.]|syntax|type" -type T ...; // ERROR "[.][.][.]|syntax|type" +type T ...int; // ERROR "[.][.][.]|syntax|type"