This is the mail archive of the
mailing list for the GCC project.
Re: PATCH RFA: Remove extern "C" from java header file
Andrew Pinski <firstname.lastname@example.org> writes:
> On Tue, Jun 9, 2009 at 9:58 PM, Ian Lance Taylor<email@example.com> wrote:
>> The java frontend header file java/verify.h has an extern "C" wrapper.
>> This breaks when compiling java with C++. ÂI can't think of any reason
>> for having it. This patch removes it. ÂBootstrapped and tested on
>> x86_64-unknown-linux-gnu. ÂOK for mainline?
> How does it break? The original code in verify.h came from the
> runtime which was originally written in C++ so they wanted to provide
> a C interface of the C++ code.
It breaks because the extern "C" is used around the gcc header files
such as system.h, coretypes.h, etc. When gcc is compiled with C++,
those header files declare C++ functions, not C functions. Thus there
is confusion as to what the functions should be named.
If it is important that this file be C++ ready when the compiler is
compiled with C, then I'll need to use some sort of #if to move the
extern "C" after the #include's. Let me know.