This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Option -I- and standard headers
- To: gcc at gcc dot gnu dot org
- Subject: Option -I- and standard headers
- From: Brad King <brad dot king at kitware dot com>
- Date: Thu, 25 Oct 2001 11:28:08 -0400 (EDT)
Hello,
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
$PREFIX/include/g++-v3/$PLATFORM/bits/gthr.h
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
-I$PREFIX/include/g++-v3/$PLATFORM/bits
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?
Thanks,
-Brad