preprocessor/5940: CPP problem when header has same name as dir in previously in search path
cholm@fys.ku.dk
cholm@fys.ku.dk
Wed Mar 13 10:56:00 GMT 2002
>Number: 5940
>Category: preprocessor
>Synopsis: CPP problem when header has same name as dir in previously in search path
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Mar 13 10:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: Christian Holm Christensen
>Release: 3.0.3 (Debian testing/unstable)
>Organization:
>Environment:
System: Linux scharff.fys.ku.dk 2.2.17 #2 SMP Tue Nov 14 17:20:25 CET 2000 i686 unknown
Architecture: i686
host: i386-pc-linux-gnu
build: i386-pc-linux-gnu
target: i386-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
If an `#include' directive, wether it a "..." or a <...> which matches a
directory name in the search path, will make CPP try to include that
directory, regardless of wether there's an actual file later on in the
search.
This problem is present in EGCS 2.91.66, GCC 2.93.4, `GCC 2.96-RH', and
GCC 3.0.3.
It may be that I'm doing things wrong, but I do believe the interface is
rather contra-intutive in that case.
I did not find anything in the documentation that could help me on this.
>How-To-Repeat:
Make the directory `stdio.h':
prompt% mkdir -p stdio.h
Make a file (say foo.c) in the current directory, with the contenst:
#include <stdio.h>
int main() {
printf("Hello World\n");
return 0;
}
Try to compile this as
prompt% gcc -c -I. foo.c
It will fail with:
foo.c:1: directory `stdio.h' specified in #include
I know that `stdio.h' is not a common name for a directory, but imagine
something like `new' in C++ code.
>Fix:
If one uses `-idirafter .' rather then `-I.', then everything works fine.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list