This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]