From patchwork Wed Dec 5 06:14:24 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: 203788 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 E39EC2C008C for ; Wed, 5 Dec 2012 17:14:43 +1100 (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=1355292885; 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=pRWJdRU QGJmyuRu934N9hIMuNeU=; b=BxyrFKj16uOqQ0xbA9zehcCnxFTn2YWZujlowvn 0FlJCt9ZN/9zdHhh53e/h/UGtKV26N9UyCfSqNWXIHeLa+pEYw27oFk7qMKIJ1u/ oVgWkEfEZUYrt4YAnZzG1GklIAo+4QsbX0+wt/JwIVLlPDJTF9RAkpEf7UHA+mB6 09D8= 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=i5UCUmOP9mA7UEynKJYI03TBnkMZivXVJ+c6CTJN+38AtyxsOovjBDBD9WarYn KrNES78if6uwk518xihraIoBPrJ9IPESD9Ht2U3CyjeUe6uw7dJY0xnimStPvSmf jD6Nnfqiu/RdDSuQ3pLilZEWAaKfSBZP+3Fijp6WNpw7o=; Received: (qmail 9122 invoked by alias); 5 Dec 2012 06:14:37 -0000 Received: (qmail 9114 invoked by uid 22791); 5 Dec 2012 06:14:36 -0000 X-SWARE-Spam-Status: No, hits=-4.4 required=5.0 tests=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; Wed, 05 Dec 2012 06:14:30 +0000 Received: by mail-pb0-f47.google.com with SMTP id un1so3095317pbc.20 for ; Tue, 04 Dec 2012 22:14:29 -0800 (PST) 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=kDcV+OVPGGrsTBOF78ZRSHljh2gv4YQUI/L4vIVrmP0=; b=bX9REKI1p1SrrMBFKAI+wagN+R2CMPSLqxCUiDtskDfBzMRH26krNdbDHbArbILfZo 3KBNGAsjjUviN69OadilObmXhLJeQ3dwMmRkv+xEIoKqayBNvQy4GeqUP76/e14xavPL 7vd3V0S3f0C5XopJwzl7Zd8UDVPsDicr5GJ8vmqyG6ia1aMqrBb/8u2Ocr/FHcnw7RO3 avKbStntODSYzdecP59Nr0pvD+03c5Up7rCzG9G7PW08yIcqKLEz8hDiSasOgQTzCJuG UUPre5h5OYdcgSxIGLc8cnGLFEys1oaxEj+Hi+DYA2ieUtqAzVYtJZ55Iu8k1z+Z8+4T /RNA== Received: by 10.66.80.65 with SMTP id p1mr41681824pax.20.1354688069306; Tue, 04 Dec 2012 22:14:29 -0800 (PST) Received: from coign.google.com ([2401:fa00:0:9:224:d7ff:fe8f:f634]) by mx.google.com with ESMTPS id m4sm2141640pav.17.2012.12.04.22.14.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Dec 2012 22:14:28 -0800 (PST) From: Ian Lance Taylor To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Subject: Go patch committed: Fix handling of dummy types for -fdump-go-spec Date: Tue, 04 Dec 2012 22:14:24 -0800 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 X-Gm-Message-State: ALoCoQk7rDYZUfnQZcdj2zeSqbCmwr0Y1c+b9YbTQ1chyUorZ4NcbR+rYApCXbEon3fWmjCBSjRVvR2hcOWN1San1c82uV2zXxSv5Dh+lMgYNM/G8oypunpLqzlQsICXcydFR0jW5nUBPeXkwTLiNVArwrUY1UYXGwCFrtxbRNce/8ZwU+9cnK3uNM9okkuCFWR/Zv2B8M05 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 The -fdump-go-spec option handles types that are never defined by outputting a dummy definition of the type. However, it does not handle types are defined but whose definition could not be represented in Go. This patch fixes that problem: if the definition was found but could not be printed, we produce a dummy type. This is necessary because there may be representable structs that have fields that point to these types. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline. Ian 2012-12-04 Ian Lance Taylor * godump.c (find_dummy_types): Output a dummy type if we couldn't output the real type. Index: godump.c =================================================================== --- godump.c (revision 194180) +++ godump.c (working copy) @@ -1,5 +1,5 @@ /* Output Go language descriptions of types. - Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Written by Ian Lance Taylor . This file is part of GCC. @@ -1164,9 +1164,11 @@ find_dummy_types (const void *ptr, void struct godump_container *data = (struct godump_container *) adata; const char *type = (const char *) ptr; void **slot; + void **islot; slot = htab_find_slot (data->type_hash, type, NO_INSERT); - if (slot == NULL) + islot = htab_find_slot (data->invalid_hash, type, NO_INSERT); + if (slot == NULL || islot != NULL) fprintf (go_dump_file, "type _%s struct {}\n", type); return true; }