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]

Re: PATCH [trunk] gengtype should generate ggc_alloc macros in plugin mode.


Hello Basile -

The patch is correct in general. But a few nitpicks:

> 2011-04-04  Basile Starynkevitch  <basile@starynkevitch.net>
>        * gengtype.c (write_typed_alloc_def): Gets extra outf_p argument
>        and use it.

...: New argument f.  Use it instead of header_file.

>        (write_typed_struct_alloc_def, write_typed_typedef_alloc_def)
>        (write_typed_alloc_defns): Likewise.
>        (main): Calls write_typed_alloc_defns with output_header.

> Index: gcc/gengtype.c
> ===================================================================
> --- gcc/gengtype.c	(revision 171950)
> +++ gcc/gengtype.c	(working copy)
> @@ -4197,52 +4197,56 @@ enum alloc_zone
>     the allocator will be zone-specific.  */
>
>  static void
> -write_typed_alloc_def (bool variable_size, const char *type_specifier,
> +write_typed_alloc_def (outf_p f,
> +		       bool variable_size, const char *type_specifier,

Here and for the rest of changed functions:
1) please describe f in the function header comment;
2) please align the second line of argument list.

> +  if (!f)
> +    return;

If f is NULL, it must be a bug, please use gcc_assert (f) instead.
Likewise in write_typed_alloc_defns.

> +  oprintf (f, "#define ggc_alloc_%s%s", allocator_type, type_name);
> +  oprintf (f, "(%s%s%s%s%s) ",
>  	   (variable_size ? "SIZE" : ""),

Here and in similar places please also align the argument list.

Thanks,
--
Laurynas


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