This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug preprocessor/17110] New: #include_next fails following #include that specifies an absolute path
- From: "wb at fnal dot gov" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Aug 2004 20:00:10 -0000
- Subject: [Bug preprocessor/17110] New: #include_next fails following #include that specifies an absolute path
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This bug first manifested for us using gcc 3.4.1 on each of multiple platforms;
it appears to be a regression from each previous gcc 3.x we have tried.
Specifically: an incorrect diagnostic ("no include path in which to search for
...") is produced under the following circumstances:
File_A contains #include "/absolute/path/to/File_B"
and
File_B contains #include_next "File_C"
Note that this failure only arises when an absolute path is specified in
Fila_A's #include.
The failure manifests when compiling via gcc as well as via g++.
The failure seems not to depend on the form of the command line -I; it does not
matter whether the directory there specified is part of a relative path or is
part of an absolute path.
A test case follows; there are 5 tiny files to be spread across 3 directories.
Because there is an absolute path involved, you will need to edit one line (in
test/test.cc) to reflect your local directory tree.
Thanks for looking into this; it's a real show-stopper for us in moving to gcc
3.4.1. Best,
-- WEB
========== test/compile ==========
#!/bin/sh
go() {
rm -f a.out
( gcc test.cc -o a.out -Inext -D$1\
&& ./a.out\
&& echo Success\
)\
|| echo Failure!;
}
echo "V1: #include \"inc/next.cc\""
go V1
echo "V2: #include \"./inc/next.cc\""
go V2
echo "V3: #include \"/complete/path/to/inc/next.cc\""
go V3
========== test/test.cc ==========
#if defined V1 // works
#include "inc/next.cc"
#elif defined V2 // works
#include "./inc/next.cc"
#else // EDIT THE NEXT LINE PER YOUR SETUP; FAILS!
#include "/complete/path/to/test/inc/next.cc"
#endif
========== test/inc/next.h ==========
// Note: this header ought be located in the same directory as the
// next.cc test program; if the directive functions properly, this
// header will not be #include'd
#error "got wrong <incnext.hh>"
========== test/inc/next.cc ==========\
#define RESULT 1
#include_next "next.h"
int main()
{
return RESULT;
}
========== test/next/next.h ==========
// If the directive functions properly, this header
// will be located instead of the one (by the same name) in the same
// directory as the next.cc test program
#ifdef RESULT
#undef RESULT
#endif
#define RESULT 0
--
Summary: #include_next fails following #include that specifies an
absolute path
Product: gcc
Version: 3.4.1
Status: UNCONFIRMED
Severity: normal
Priority: P1
Component: preprocessor
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wb at fnal dot gov
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17110