This is the mail archive of the gcc@gcc.gnu.org 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]
Other format: [Raw text]

Re: cpp, CPLUS_INCLUDE_PATH, and g++: bug or feature?


Gerald Pfeifer <gerald@pfeifer.com> writes:

| However, once I use the g++ driver to compile this program the error
| is back:
| 
|   % g++ x.c
|   x.c:1:18: test.h: No such file or directory
| 
| Which I believe contradicts the following from cppenv.texi, since even
| though we use the g++ driver, the program still is compiled as C input:

I would expect the program to be compiled as a C++ input.

|   The[se] environment variables apply only when preprocessing the
|   particular language indicated. 
| 
| Interestingly, though, the preprocessor does set __cplusplus, so it
| seems g++ preprocesses .c files as C++, but then compiles them as C.
| 
| Feature, bug, or potential to improve documentation?

It must be a bug.  If it process them as a C++ files, it must compile
them as C++.  Similarly, if gcc preprocess files as C files, one would
expect it to compile it as C programs with appropriate semantics.
Otherwise it would lead to inconsistent semantics that the
preprocessor processes as language X and the front-end processes as
language Y. 

-- Gaby


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