Patch to re-enable format checking for warning, error etc.

Gabriel Dos Reis
Sun Jul 3 00:27:00 GMT 2005

"Joseph S. Myers" <> writes:

| As a further piece of followup to
| <> and
| <>, it became
| apparent that there were various format errors in GCC not being caught
| because of format checking being disabled for various format functions
| in the middle-end.  This patch re-enables that format checking.  There
| are now four format attributes for GCC-internal formats based on the
| pretty-printing infrastructure:
| gcc_diag - core formats supported by pretty-print.c only
| gcc_tdiag - middle-end formats (those supported by
| default_tree_printer in toplev.c and by the front ends with their own
| printers, i.e. C/C++/ObjC/ObjC++) - gcc_diag plus %D %F %T
| gcc_cdiag - C formats - gcc_tdiag plus %E
| gcc_cxxdiag - C++ formats - gcc_cdiag plus various others

For my curiousity what does "t" in gcc_tdiag means?  "tree"?

| Not much presently uses gcc_diag (pp_printf and pp_verbatim are
| declared that way), since %D %F %T are always available with the
| pretty-printing infrastructure.  However, it would be desirable for
| the pretty-printing and diagnostic infrastructure to be available for
| the the various programs (e.g. the "gcc" driver) not linking with
| toplev.c and having no knowledge of the type "tree".  Such programs
| would use warning/error/... with the plain gcc_diag format type.  (It
| would be necessary for the %J format, with its knowledge of "tree", to
| become a shared middle-end/front-end format rather than being in the
| core pretty-printer.)
| Bootstrapped with no regressions on x86_64-unknown-linux-gnu.  I also
| configured cross-compilers to one target for each CPU directory and
| fixed any format warnings building the <cpu>.o file - many of which
| would have shown up without the patch (subject in some cases to
| building with a sufficiently recent compiler, for non-bootstrap
| builds).  OK to commit?

Yes.  Thanks.

-- Gaby

More information about the Gcc-patches mailing list