From patchwork Tue Oct 2 23:51:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 188688 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 586CF2C00B2 for ; Wed, 3 Oct 2012 09:51:49 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1349826710; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=SROrehf LQFLJIkBXk4YOlsdc8Dc=; b=R5Ay/qCPrrVzTtrH7n5lPCciMsbJ2nx+O90230K 4DYsmpVufENu4j3AlH5VAMrIsOoeo0wsAPpRe33SPEiW/tNLoXMwvgpuvvWao+wr 4n/u2GXx7smdlG7k+4Sv0o+077eOk2l5gmVqPZlvoF79ld6ba63UFM3x9t8Lq1aH 5ScQ= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-Google-DKIM-Signature:Received:Received:From:To:Subject:Date:Message-ID:User-Agent:MIME-Version:Content-Type:X-Gm-Message-State:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=XOOtcR4CoCHCA4zpVFBQ7qE6jqxqMsAJ7JZ8q7QCNpW4yH7GFjSAsHKzt6iHCW y0fmkQalUBiyYtWdqTGDtX5m+Lhyx51lahRo4TYo4/sB8USZMKKWCEYEm35S0dvY OqEK3pjY6xbwkf9X+80ERB92o0xmdq1xjAWgcaDE8FjLU=; Received: (qmail 6680 invoked by alias); 2 Oct 2012 23:51:47 -0000 Received: (qmail 6668 invoked by uid 22791); 2 Oct 2012 23:51:46 -0000 X-SWARE-Spam-Status: No, hits=-5.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, T_TVD_MIME_NO_HEADERS X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 02 Oct 2012 23:51:41 +0000 Received: by pbbro12 with SMTP id ro12so9694435pbb.20 for ; Tue, 02 Oct 2012 16:51:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type:x-gm-message-state; bh=+Gl9O1ROPTA7xJhXR2WCsuNjH/daxvfEewlhJ0PQ1yA=; b=XQ4q0b2jaY68h4J3S8LulKfMWQYACWos9DggbzjIlGjBthPqjdTjH3AuWNN0741W8Y V/spb3u2vLnwxmZ59JcbFT1l87IAew2MF4mZgolGfHXELECHK9Y8Hq+F4QseKXbfIikY EK+P1nsAvskHSIhzAi0ISZcg/pO+KztgAUydg3e4366E3ojVjC1/Tch6tVcC0JE99r5/ g+zp6EKeQiKAkTypccWHTkoOKK7CxrZOJXV1b0ujafbqiv/1rL9T0FqIvwec7y0uhSKU egwsHgGzW1aQqqD4lvW5TrOFTbu48O+y+25XtC4wdI/AFLNtsloiJYqyyXCLuMpBrVj5 SceQ== Received: by 10.68.242.97 with SMTP id wp1mr8280331pbc.159.1349221901252; Tue, 02 Oct 2012 16:51:41 -0700 (PDT) Received: from coign.google.com ([67.218.104.143]) by mx.google.com with ESMTPS id tt6sm1601892pbc.51.2012.10.02.16.51.38 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 02 Oct 2012 16:51:40 -0700 (PDT) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Fix some type reflection strings Date: Tue, 02 Oct 2012 16:51:35 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQmgtO1oocVXhCXS12SRxwmatLJBx720HfGRjsQS3CHvpi2QdoSBqFTDu1qb9GTE+YWiDQHCpYsJZegd06GQWWY3iuCt7HvDL9cHusgEQeRNJrrCpJeGhXIbPP/aFCmVJxIOThK/2fwqqar4+EyovPvMSRr1dHaBdvOAgIdl5gvVUoWKSUsduepbVZVB8AZSfo1xsLP0 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 the Go frontend fixes the type reflection strings in a couple of cases to match those generated by the gc compiler. For an empty struct, this generates "struct {}" rather than "struct { }". For a type defined within a function, this generates pkg.type rather than pkg.function_name$type. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline and 4.7 branch. Ian diff -r 83133095b520 go/types.cc --- a/go/types.cc Tue Oct 02 15:19:17 2012 -0700 +++ b/go/types.cc Tue Oct 02 16:27:18 2012 -0700 @@ -4919,14 +4919,15 @@ void Struct_type::do_reflection(Gogo* gogo, std::string* ret) const { - ret->append("struct { "); + ret->append("struct {"); for (Struct_field_list::const_iterator p = this->fields_->begin(); p != this->fields_->end(); ++p) { if (p != this->fields_->begin()) - ret->append("; "); + ret->push_back(';'); + ret->push_back(' '); if (p->is_anonymous()) ret->push_back('?'); else @@ -4959,7 +4960,10 @@ } } - ret->append(" }"); + if (!this->fields_->empty()) + ret->push_back(' '); + + ret->push_back('}'); } // Mangled name. @@ -8390,6 +8394,7 @@ } if (this->in_function_ != NULL) { + ret->push_back('\t'); ret->append(Gogo::unpack_hidden_name(this->in_function_->name())); ret->push_back('$'); if (this->in_function_index_ > 0) @@ -8399,6 +8404,7 @@ ret->append(buf); ret->push_back('$'); } + ret->push_back('\t'); } ret->append(Gogo::unpack_hidden_name(this->named_object_->name())); }