This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: new switch that warns about missing includes
- To: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Subject: Re: new switch that warns about missing includes
- From: Florian Schintke <schintke at zib dot de>
- Date: Thu, 9 Aug 2001 09:58:18 +0200
- Cc: gcc at gcc dot gnu dot org
- References: <20010808180500.F4123@csr-pc2.zib.de> <20010809123403.A10962@hg.cs.mu.oz.au>
- Reply-To: Florian Schintke <schintke at zib dot de>
[Fergus Henderson]
> On 08-Aug-2001, Florian Schintke <schintke@zib.de> wrote:
> > I am thinking of a switch for the gcc that warns you about missing
> > includes of standard header files to get higher reliablity of your
> > code.
> ...
> > I don't know exectly how to implement this. Maybe you are
> > interested to think about it.
>
> I've been using the following Makefile recipe, which will catch some
> but not all cases of header files which are not properly self-contained.
>
> HDRS = foo.h bar.h baz.h
>
> check: $(HDRS:%.h=%.check.o)
>
> %.check.c : %.h
> echo "#include \"$*.h\"" > $@
Thank you for this rule, Fergus Henderson. This helps for the case
that you include in a .c file more than one .h file and use in the
second .h file some things that are defined in the first .h file
included. I think it is a rather weak check and it does not help to
check what is done by includes done in the .h files itself.
Florian Schintke
--
Florian Schintke <schintke@zib.de>, http://www.zib.de/schintke/