From patchwork Tue Jul 13 09:49:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [gccgo] Support anonymous struct fields with -ggo Date: Mon, 12 Jul 2010 23:49:44 -0000 From: Ian Taylor X-Patchwork-Id: 58729 Message-Id: To: gcc-patches@gcc.gnu.org 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