Another issue with diagnostic format-checker
Gabriel Dos Reis
gdr@integrable-solutions.net
Sat Jul 19 18:02:00 GMT 2003
"Zack Weinberg" <zack@codesourcery.com> writes:
| Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
|
| > "Zack Weinberg" <zack@codesourcery.com> writes:
| >
| > | Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
| > |
| > | > Instead of insisting on hardwiring GCC_DIAG_STYLE (thus opening the
| > | > door for all kinds of nightmarre) in files, I'll reiterate what I
| > | > suggested earlier:
| > | >
| > | > GCC_DIAG_STYLE should be set by each individual front-end, directly.
| > | >
| > | > We already do this for other flags.
| > | > An obvious way to do that is for each front-end Makefile to use
| > | > something like
| > | >
| > | > -DGCC_DIAG_STYLE=__gcc_xxx__
| > | >
| > | > when compiling files used in that front end. That way, we don't depend
| > | > on inclusion order, or file inclusion otherwise unnecessary.
| > |
| > | If we cannot have it in header files, I would prefer an explicit
| > | #define at the top of every .c file.
| >
| > Defining it at the top of every .c file does not make the core problem
| > go away -- in fact it is no different from what Kaveh did.
|
| Okay, hold on a second. I have not been following this discussion
| closely, but there seems to be a basic confusion on your part.
Then maybe you might want to read last exchanges with Kaveh.
| The
| format-checking takes place when the compiler is compiled, not when it
| runs. Therefore the set of format specifiers valid in each .c file
| must be determined statically when that .c file is compiled. The only
| way we could make it vary depending on the front end, for a file that
| is put into more than one front end, is to compile that file more than
| once.
I think you misundertood what Kaveh and I agreed on:
(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.
If you're not closely following the discussion, it won't help to
create one more level of confusion.
-- Gaby
More information about the Gcc
mailing list