diff mbox

misc gengtype micro-patch (computing fn in get_output_file_for_structure)

Message ID 20101108080759.bceae91d.basile@starynkevitch.net
State New
Headers show

Commit Message

Basile Starynkevitch Nov. 8, 2010, 7:07 a.m. UTC
On Mon, 8 Nov 2010 05:37:37 +0200
Laurynas Biveinis <laurynas.biveinis@gmail.com> wrote:
> 
> Thus your patch is, unfortunately, not OK, and the proper fix would be
> - replace get_output_file_for_structure with
> get_output_file_with_visibility(NULL) in
> write_splay_tree_allocator_def;
> - in get_output_file_for_structure put a gcc_assert that s is
> UNION_OR_STRUCT_P only.
> 
> Would you be willing to do this?
 
##### patch against trunk ########

########### gcc/ChangeLog entry
2010-11-08  Basile Starynkevitch  <basile@starynkevitch.net>

	* gengtype (get_output_file_for_structure): Ensure type is union 
	or struct.
	(write_splay_tree_allocator_def): Use get_output_file_with_visibility.

#####

Ok for trunk? I hope yes, since you asked it!


Cheers

Comments

Laurynas Biveinis Nov. 8, 2010, 9:17 a.m. UTC | #1
2010/11/8 Basile Starynkevitch <basile@starynkevitch.net>:
> 2010-11-08  Basile Starynkevitch  <basile@starynkevitch.net>
>
>        * gengtype (get_output_file_for_structure): Ensure type is union
>        or struct.
>        (write_splay_tree_allocator_def): Use get_output_file_with_visibility.


I assume you have tested this patch and the generated files are
identical, i.e. splay tree allocators go to gtype-desc.c?

If yes, the patch is OK. Thanks,
Basile Starynkevitch Nov. 8, 2010, 5:40 p.m. UTC | #2
On Mon, 8 Nov 2010 11:17:24 +0200
Laurynas Biveinis <laurynas.biveinis@gmail.com> wrote:

> 2010/11/8 Basile Starynkevitch <basile@starynkevitch.net>:
> > 2010-11-08  Basile Starynkevitch  <basile@starynkevitch.net>
> >
> >        * gengtype (get_output_file_for_structure): Ensure type is union
> >        or struct.
> >        (write_splay_tree_allocator_def): Use get_output_file_with_visibility.
> 
> 
> I assume you have tested this patch and the generated files are
> identical, i.e. splay tree allocators go to gtype-desc.c?

Yes, yes, yes.

> If yes, the patch is OK. Thanks,
Yes
Committed revision 166442.
diff mbox

Patch

Index: gcc/gengtype.c
===================================================================
--- gcc/gengtype.c	(revision 166428)
+++ gcc/gengtype.c	(working copy)
@@ -2637,9 +2637,12 @@  output_type_enum (outf_p of, type_p s)
 static outf_p
 get_output_file_for_structure (const_type_p s, type_p *param)
 {
-  const char *fn = s->u.s.line.file;
+  const char *fn;
   int i;
 
+  gcc_assert (UNION_OR_STRUCT_P (s));
+  fn = s->u.s.line.file;
+
   /* This is a hack, and not the good kind either.  */
   for (i = NUM_PARAM - 1; i >= 0; i--)
     if (param && param[i] && param[i]->kind == TYPE_POINTER
@@ -4062,7 +4065,7 @@  output_typename (outf_p of, const_type_p t)
 static void
 write_splay_tree_allocator_def (const_type_p s)
 {
-  outf_p of = get_output_file_for_structure (s, NULL);
+  outf_p of = get_output_file_with_visibility (NULL);
   oprintf (of, "void * ggc_alloc_splay_tree_");
   output_typename (of, s);
   oprintf (of, " (int sz, void * nl)\n");