diff options
author | Ian Lance Taylor <iant@google.com> | 2011-01-11 22:58:35 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-01-11 22:58:35 +0000 |
commit | 4053a5a0aff55ae8e4be6ecb0267d5c1668232a5 (patch) | |
tree | 7fb03b7a58793be01beab7e1afb0ff1426858776 /gcc | |
parent | fa3e04d2db350acfc275a678668c2370fc7d6f88 (diff) | |
download | gcc-4053a5a0aff55ae8e4be6ecb0267d5c1668232a5.zip gcc-4053a5a0aff55ae8e4be6ecb0267d5c1668232a5.tar.gz gcc-4053a5a0aff55ae8e4be6ecb0267d5c1668232a5.tar.bz2 |
godump.c (go_output_var): Don't output the variable if there is already a type with the same name.
* godump.c (go_output_var): Don't output the variable if there is
already a type with the same name.
From-SVN: r168683
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/godump.c | 16 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a1fc0d1..a9bb4c2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2011-01-11 Ian Lance Taylor <iant@google.com> + * godump.c (go_output_var): Don't output the variable if there is + already a type with the same name. + +2011-01-11 Ian Lance Taylor <iant@google.com> + * godump.c (go_format_type): Don't generate float80. 2011-01-11 Richard Henderson <rth@redhat.com> diff --git a/gcc/godump.c b/gcc/godump.c index 3b4b766..4ec41f0 100644 --- a/gcc/godump.c +++ b/gcc/godump.c @@ -715,13 +715,27 @@ go_output_typedef (struct godump_container *container, tree decl) static void go_output_var (struct godump_container *container, tree decl) { + bool is_valid; + if (pointer_set_contains (container->decls_seen, decl) || pointer_set_contains (container->decls_seen, DECL_NAME (decl))) return; pointer_set_insert (container->decls_seen, decl); pointer_set_insert (container->decls_seen, DECL_NAME (decl)); - if (!go_format_type (container, TREE_TYPE (decl), true, false)) + + is_valid = go_format_type (container, TREE_TYPE (decl), true, false); + if (is_valid + && htab_find_slot (container->type_hash, + IDENTIFIER_POINTER (DECL_NAME (decl)), + NO_INSERT) != NULL) + { + /* There is already a type with this name, probably from a + struct tag. Prefer the type to the variable. */ + is_valid = false; + } + if (!is_valid) fprintf (go_dump_file, "// "); + fprintf (go_dump_file, "var _%s ", IDENTIFIER_POINTER (DECL_NAME (decl))); go_output_type (container); |