This is the mail archive of the gcc-bugs@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: c++/5997: CPLUS_INCLUDE_PATH not working properly


On Tue, Mar 19, 2002 at 10:06:12AM +0100, Jorgo Bakker wrote:
> >
> > You're quite right - I'd not tested the PR, assuming it must be right.
> > I just looked for when the last time this area of code was changed.  I
> > can't reproduce it either.  jbakker, can you elaborate on what problem
> > you're seeing?
> >
> > Neil.
> 
> Hmm, I started to doubt myself, and indeed: on Linux it works fine. However,
> my sun-sparc-solaris2.[6-8] platforms all give the following output.
> It seems as if CPLUS_INCLUDE_PATH is interpreted as a PATH to C-include files
> only; hence the error.

Oh! I see what the problem is now.

> . /data/Users/jbakker/tmp/gcc-bug/foo/tmp/include/foo.h
> In file included from main.cc:1:
> /data/Users/jbakker/tmp/gcc-bug/foo/tmp/include/foo.h:5: declaration of C
>    function `void handle(float)' conflicts with
> /data/Users/jbakker/tmp/gcc-bug/foo/tmp/include/foo.h:4: previous declaration
>    `void handle(int)' here

It is reading the header file you asked it to, but interpreting that
file as a "system header" - and on sparc-sun-solaris2.x, "system
headers" get treated as wrapped in an implicit extern "C".

I'm not inclined to change what *_INCLUDE_PATH do - there are probably
people out there depending on having them be system headers.  You can
work around the problem by putting extern "C++" { ... } around the
entire content of your header file.

Also, the sparc-sun-solaris* configurations should probably be changed
to disable the implicit extern "C".  If I remember correctly, Solaris
has had extern "C" in its header files from day one.

zw


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