This is the mail archive of the
mailing list for the GCC project.
Re: Another issue with diagnostic format-checker
Gabriel Dos Reis <firstname.lastname@example.org> writes:
> (1) format checking is done when we use GCC (modulo versions).
> (2) the bootstrapping compiler is told (via attributes) what to check.
> (3) the attraibutes are hardwired in the files.
> the last point is what is causing the trouble.
> When the current front-end (which we want to build an executable for)
> invokes the bootstrapping compiler, it is its responsability to tell
> what is the set of format specifiers. That set is specified
> statically via -DGCC_DIAG_STYLE=__gcc_xxx__, not the way it is
> currently done. But statically.
Okay, I understand this. However, this suggests that you intend to
compile files shared between front ends more than once, with different
settings of GCC_DIAG_STYLE. I think this is a bad idea. The actual
content of the file does not change - the .o file should be identical -
and, in particular, the format specifiers that are used in that file
do not change. You are in effect doing an intersection operation on
the diagnostic styles - far better to perform that intersection once,
write the result into c-format.c, and then wire the appropriate
settings into the files themselves. Then you need not compile files
more than once, and you need not add complexity to the Makefile.