This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: new switch that warns about missing includes


[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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]