Why warn about #include_next in system headers?

Zack Weinberg zackw@stanford.edu
Tue Feb 6 00:30:00 GMT 2001


On Tue, Feb 06, 2001 at 12:22:11AM +0100, Franz Sirl wrote:
> On Tuesday 06 February 2001 00:15, Neil Booth wrote:
> > Franz Sirl wrote:-
> >
> > > while compiling kdelibs-2.1beta2 with gcc-20010204 there are a lot of
> > >
> > > /usr/include/limits.h:124:3: warning: #include_next is a GCC extension
> > >
> > > I find this warning rather useless in systemheaders, in this case glibc
> > > _wants_ to use the GCC extension, so why warn?
> >
> > There are only 2 reasons I can think of:
> >
> > 1) You asked for warnings in system headers
> > 2) For some reason CPP doesn't think the file it appears in is a
> > system header.
> 
> Hmm, does -I/usr/include qualify for 2)?

Yes.  -I /usr/include means 'search /usr/include, as a user header
directory, BEFORE the default search path.'  cpp never gets to the
/usr/include entry (which is considered a system directory) on the
default search path.

Why are you doing -I /usr/include anyway?  This will break even worse
on platforms that need nontrivial fixincludes repairs.

zw


More information about the Gcc-bugs mailing list