This is the mail archive of the 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]

Option -I- and standard headers


I just created a file with only one line:
---- t.cxx ----
#include <iostream>
----- end -----

I then ran GCC 3.0 on it with the "-I-" option like this:

gcc -I- -c t.cxx

The result was a preprocessor error with a library header that could not
be found.  After a series of includes, the file


has the line

#include "gthr-single.h"

This includes a file in the same directory, but depends on the fact that
the preprocessor searches a file's own directory for include files
first.  The -I- option breaks this, so it cannot be used unless


is added explicitly.  I don't think this is the desired behavior because
the user should not have to dig into GCC's internal include paths just to
use the -I- option for his/her own project, especially because the
internal paths have platform-dependent names.

A simple fix is to change the line mentioned above to

#include "bits/gthr-single.h"

because $PREFIX/include/g++-v3/$PLATFORM is already a standard include
search path entry.  Then, even when -I- is specified, the headers can
still be found.

I assume the other gthr-* include lines in gthr.h would also need the same
change.  There may also be other headers in the 3.0 standard library with
the same problem, but they don't show up from just including iostream.

Am I missing something, or is this a bug in the headers?


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