Hi!

On Tue, Apr 27, 2021 at 10:32:37AM -0500, Bill Schmidt via Gcc-patches wrote:
> --- a/gcc/gengtype-state.c
> +++ b/gcc/gengtype-state.c
> @@ -1269,7 +1269,7 @@ state_writer::write_state_files_list (void)
>    int i = 0;
>    /* Write the list of files with their lang_bitmap.  */
>    begin_s_expr ("fileslist");
> -  fprintf (state_file, "%d", (int) num_gt_files);
> +  fprintf (state_file, "%d %d", (int) num_gt_files, (int) num_build_headers);

Please use %zd instead, and don't cast?  We require a moderately new
host compiler nowadays :-)

>    for (i = 0; i < (int) num_gt_files; i++)

For this one you can make i itself a size_t.  Remember: all explicit
casts are evil (and just some are useful).

Alternatively you can make num_gt_files (and your new num_build_headers)
itself an int: it's not like we could have 2G of those anyway.

> --- a/gcc/gengtype.h
> +++ b/gcc/gengtype.h
> @@ -55,6 +55,11 @@ struct fileloc
>  extern const input_file** gt_files;
>  extern size_t num_gt_files;
>  
> +/* Table of headers to be included in gtype-desc.c that are generated
> +   during the build.  These are identified as "./<filename>.h".  */
> +extern const char** build_headers;

extern const char **build_headers;

(I hope someone who can approve this will review it.)


Segher

Reply via email to