This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix inappropriate errors.h includes
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 27 May 2010 20:02:52 +0100
- Subject: Re: Fix inappropriate errors.h includes
- References: <Pine.LNX.4.64.1005221137250.22519@digraph.polyomino.org.uk>
"Joseph S. Myers" <joseph@codesourcery.com> writes:
> GCC has the main fully-featured set of diagnostic functions in
> diagnostic.c (supported by pretty-print.c), for use by all diagnostics
> (as opposed to debugging dumps etc. for GCC developers only) from the
> compilers proper. It has various other simpler sets in the driver and
> other programs installed by GCC (which I plan to replace with the
> fully-featured set, at least in the driver). And it has a cut-down
> set of diagnostic functions, printf formatting only, no i18n, in
> errors.c, for use by the generator programs that are only used when
> building GCC and do not need any fancy features. (errors.o - the
> host-side as opposed to build-side build of errors.c - is used in gcov
> and gcov-dump only for the sake of fancy_abort. gcov-dump is a
> non-installed debugging program for which minimal diagnostics support
> is appropriate, while gcov ought eventually to use diagnostic.c.)
>
> errors.c has a corresponding header errors.h. This is mainly included
> in the sources of generator programs - but a few files from the
> compiler proper wrongly include it as well. The correct header for
> diagnostic functions such as "warning" and "error" in the compiler
> proper is toplev.h right now (though they should move out of there
> either to diagnostic.h or to a separate header for the core diagnostic
> facilities), not errors.h. (rtl.c correctly selects which header to
> include depending on the setting of GENERATOR_FILE.)
>
> This patch changes the inappropriate errors.h includes to include
> toplev.h instead - or in one case removes the include because the file
> in question uses no diagnostic functions. (One dependency update is
> for a file not modified in this patch that already included toplev.h
> but where Makefile.in wrongly reported a dependency on errors.h.)
>
> Bootstrapped with no regressions on x86_64-unknown-linux-gnu. OK to
> commit?
>
> 2010-05-22 Joseph Myers <joseph@codesourcery.com>
>
> * dbgcnt.c: Include toplev.h instead of errors.h.
> * ira-emit.c: Don't include errors.h.
> * ira.c: Include toplev.h instead of errors.h.
> * lto-compress.c: Include toplev.h instead of errors.h.
> * Makefile.in (lto-compress.o, lto-streamer-out.o, ira-emit.o,
> ira.o, dbgcnt.o): Update dependencies.
Belated reply, sorry, but do you think it would be a good idea to
#error in errors.h unless GENERATOR_FILE is defined?
Richard