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


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

Re: libstdc++ headers and system headers


On Feb 16, 2001, Joe Buck <jbuck@synopsys.COM> wrote:

> Alexandre Oliva writes:
>> In fact, IMO, it's *wrong* to add system header directories with -I.
>> You should use -isystem for those.

> This statement will be seen as strange by anyone who must use more than
> one compiler.

A system header, by definition, is one that is searched by the
compiler by default.  You should never have to -I it, and it's always
been the case that -I/usr/include would just break GCC on many
platforms.  include/g++-v3 is no different.  

> -isystem is gcc-specific, while -I is mostly portable.

This is just because most other compilers don't offer any way for the
user to override their internal notions of what the system headers are
located.  GCC does.

> Now, if the only effect of using -I for system headers is, say, you don't
> get the pragma that disables warnings, that's probably OK.  But if more
> severe breakage occurs, it will probably be seen as a bug (sorry Robert,
> I used that word again!).

-I/usr/include will, for example, cause an inappropriate varargs.h to
be found by GCC.  And that's just the beginning.  Potentially, many
other things will break.  It's just wrong to use -I/usr/include; the
GCC manual has warned about this for ages, and contains a complete
explanation of the problem.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me


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