This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[gccgo] Support anonymous struct fields with -ggo
- From: Ian Lance Taylor <iant at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 13 Jul 2010 02:49:44 -0700
- Subject: [gccgo] Support anonymous struct fields with -ggo
This patch to goout.c supports anonymous struct fields when using -ggo,
which can arise when using the gcc anonymous union extension. Committed
to gccgo branch.
Ian
Index: goout.c
===================================================================
--- goout.c (revision 161752)
+++ goout.c (working copy)
@@ -429,13 +429,20 @@ go_output_type (struct goout_container *
case RECORD_TYPE:
{
tree field;
+ int i;
fprintf (asm_out_file, "struct { ");
+ i = 0;
for (field = TYPE_FIELDS (type);
field != NULL_TREE;
field = TREE_CHAIN (field))
{
- if (DECL_NAME (field) != NULL)
+ if (DECL_NAME (field) == NULL)
+ {
+ fprintf (asm_out_file, "_f%d ", i);
+ i++;
+ }
+ else
{
const char *var_name;
void **slot;
@@ -449,8 +456,6 @@ go_output_type (struct goout_container *
else
fprintf (asm_out_file, "_%s ", var_name);
}
- else
- fprintf (asm_out_file, "INVALID-unnamed ");
if (DECL_BIT_FIELD (field))
fprintf (asm_out_file, "INVALID-bit-field");
else