From patchwork Thu Oct 16 19:55:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 400370 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id CE3111400B8 for ; Fri, 17 Oct 2014 06:55:52 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; q=dns; s= default; b=kHFV3kMaVqy93KbnoDomoyAistTVOoxWfF5rPB1ZJ+MPCX3L/819e k/o9Q3DAOinS61cpnsHBkaUttNEN/9IPRMuZWd0V6dopAqpqsLT+4JZOBOfGktcr +hx0Qf+NqC97P6zJG6QfSZR23dnjCD9r97QO6KGBQxLtPi0eymJoI0= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type; s= default; bh=hpdHuumN17hETFIC1oalBKpV6kA=; b=CZtpb3IXfMck0rRhhwWy n4M5DXzH+Tv6PHDQyucOUypug10iRNvRooBunMVzMPMHBR+DTDu23vBYo5+Eb+At mpFhv7l+IJqv+tDM/y3tBgC8TzKdkm1EwRCplXyCs4dKxqrqs9l+2wzk8d+iJWv/ DlhtLHRfy3h80VLLhBXVlW8= Received: (qmail 23837 invoked by alias); 16 Oct 2014 19:55:45 -0000 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 Received: (qmail 23827 invoked by uid 89); 16 Oct 2014 19:55:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_LOW, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-pa0-f42.google.com Received: from mail-pa0-f42.google.com (HELO mail-pa0-f42.google.com) (209.85.220.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Thu, 16 Oct 2014 19:55:43 +0000 Received: by mail-pa0-f42.google.com with SMTP id bj1so4045298pad.15 for ; Thu, 16 Oct 2014 12:55:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-type; bh=/szSH8yyLFOKUUcJhFG5kQHrpWqZ/FG4kINQo/3YiGc=; b=bPmyZY+xwUmHjDlc9BaK05MLmzjLFKOnbf2pzPakgOlLI8DysB0Np0+B2r+KiqUl0F ZEjS65EYq+vCPZkYNcAp/eHrivlSKkvstvlN27RaUTWhCQliXpjlNbQrQU2+DytM2VpA q02QRwhqWARB7l8Z4rPuQM4xE9Kja6Ya5znwHsRqSxzcaE1LR8GOFP0IZvUYk50NZ/xo Fh2AOxwfWta4xpJFNprKrdBwxD6O4BYYKnzqoc+WB/7o43aeZw0jgd9wpvOhsD4TIfkc BkFwiRjjZcnyM34x5Yq42GuJFaWVBDMguEQqKenjUfiDQca+r9li0coqElWsjmpvD6W2 Q1gQ== X-Gm-Message-State: ALoCoQmWQUb8oMYu5rw0kll5P+rGAmMTSTH/s5rUhk2blcvCb40ZYYSsrCCm8g70RD+mrlhl0hIq X-Received: by 10.68.216.70 with SMTP id oo6mr3663432pbc.124.1413489340997; Thu, 16 Oct 2014 12:55:40 -0700 (PDT) Received: from iant-glaptop.roam.corp.google.com.google.com ([172.26.53.27]) by mx.google.com with ESMTPSA id u5sm9700212pdl.51.2014.10.16.12.55.39 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 16 Oct 2014 12:55:40 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: method names must be non-blank Date: Thu, 16 Oct 2014 12:55:37 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes The Go language spec was clarified to say that method names must be non-blank. This patch by Chris Manghane implements this restriction in the Go frontend. This requires a couple of testsuite changes, already in the master testsuite and included in this patch. This fixes http://golang.org/issue/8078 . Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian Index: gcc/go/gofrontend/parse.cc =================================================================== --- gcc/go/gofrontend/parse.cc (revision 216343) +++ gcc/go/gofrontend/parse.cc (working copy) @@ -1253,6 +1253,8 @@ Parse::method_spec(Typed_identifier_list if (this->advance_token()->is_op(OPERATOR_LPAREN)) { // This is a MethodName. + if (name == "_") + error_at(this->location(), "methods must have a unique non-blank name"); name = this->gogo_->pack_hidden_name(name, is_exported); Type* type = this->signature(NULL, location); if (type == NULL) Index: gcc/testsuite/go.test/test/interface/explicit.go =================================================================== --- gcc/testsuite/go.test/test/interface/explicit.go (revision 216257) +++ gcc/testsuite/go.test/test/interface/explicit.go (working copy) @@ -83,12 +83,12 @@ var m4 = M(jj) // ERROR "invalid|wrong t type B1 interface { - _() + _() // ERROR "methods must have a unique non-blank name" } type B2 interface { M() - _() + _() // ERROR "methods must have a unique non-blank name" } type T2 struct{} Index: gcc/testsuite/go.test/test/interface/fail.go =================================================================== --- gcc/testsuite/go.test/test/interface/fail.go (revision 216257) +++ gcc/testsuite/go.test/test/interface/fail.go (working copy) @@ -14,7 +14,6 @@ type I interface { func main() { shouldPanic(p1) - shouldPanic(p2) } func p1() { @@ -30,19 +29,6 @@ type S struct{} func (s *S) _() {} -type B interface { - _() -} - -func p2() { - var s *S - var b B - var e interface{} - e = s - b = e.(B) - _ = b -} - func shouldPanic(f func()) { defer func() { if recover() == nil {