From patchwork Thu Oct 4 18:20:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: PATCH trunk: gengtype honoring mark_hook-s inside struct inside union-s Date: Thu, 04 Oct 2012 08:20:19 -0000 From: Basile Starynkevitch X-Patchwork-Id: 189240 Message-Id: <20121004182019.GA21760@hector.lesours> To: Basile Starynkevitch Cc: Laurynas Biveinis , gcc-patches@gcc.gnu.org, dnovillo@google.com On Wed, Oct 03, 2012 at 01:02:44PM +0200, Basile Starynkevitch wrote: > So I applied and I am proposing the following patch to gcc trunk 192031 > (Laurynas, I did take your remarks into account) > ##### patch to trunk > Index: gcc/gengtype.c > =================================================================== > --- gcc/gengtype.c (revision 192031) > +++ gcc/gengtype.c (working copy) > @@ -2810,6 +2810,7 @@ walk_type (type_p t, struct walk_type_data *d) > const char *oldval = d->val; > const char *oldprevval1 = d->prev_val[1]; > const char *oldprevval2 = d->prev_val[2]; > + const char *struct_mark_hook = NULL; > const int union_p = t->kind == TYPE_UNION; > int seen_default_p = 0; > options_p o; > @@ -2833,7 +2834,14 @@ walk_type (type_p t, struct walk_type_data *d) > if (!desc && strcmp (o->name, "desc") == 0 > && o->kind == OPTION_STRING) > desc = o->info.string; > + else if (!struct_mark_hook && strcmp (o->name, "mark_hook") == 0 > + && o->kind == OPTION_STRING) > + struct_mark_hook = o->info.string; > > + if (struct_mark_hook) > + oprintf (d->of, "%*s%s (&%s));\n", > + d->indent, "", struct_mark_hook, oldval); Sorry for the typo, the patch should have only one closing parenthesis. So I'm applying the following patch to trunk to correct it. I hope that correcting such a typo falls into the "obvious patch" rule, so I dare committing it right now, reusing the same ChangeLog entry. % svn commit gcc/gengtype.c Sending gcc/gengtype.c Transmitting file data . Committed revision 192095. If you feel it is wrong to correct such a typo without asking, I'll revert this obvious commit. Apologies for the typo. Cheers. Index: gengtype.c =================================================================== --- gengtype.c (revision 192094) +++ gengtype.c (working copy) @@ -2839,7 +2839,7 @@ struct_mark_hook = o->info.string; if (struct_mark_hook) - oprintf (d->of, "%*s%s (&%s));\n", + oprintf (d->of, "%*s%s (&%s);\n", d->indent, "", struct_mark_hook, oldval); d->prev_val[2] = oldval;