From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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-Archive: List-Post: List-Help: Sender: gcc-patches-owner@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 20:04:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg01611.txt.bz2 --=-=-= Content-Type: text/plain Content-length: 400 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 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=foo.patch Content-Description: patch Content-length: 1736 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 { --=-=-=--