From patchwork Wed Dec 5 06:14:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Go patch committed: Fix handling of dummy types for -fdump-go-spec X-Patchwork-Submitter: Ian Taylor X-Patchwork-Id: 203788 Message-Id: To: gcc-patches@gcc.gnu.org, gofrontend-dev@googlegroups.com Date: Tue, 04 Dec 2012 22:14:24 -0800 From: Ian Lance Taylor List-Id: 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; }