|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
PATCH RFA: Remove extern "C" from java header fileThe 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? Ian 2009-06-09 Ian Lance Taylor <iant@...> * verify.h: Remove extern "C". Index: java/verify.h =================================================================== --- java/verify.h (revision 148327) +++ java/verify.h (working copy) @@ -1,5 +1,6 @@ /* Declarations to interface gcj with bytecode verifier. - Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009 + Free Software Foundation, Inc. This file is part of GCC. @@ -26,11 +27,6 @@ #ifndef GCC_VERIFY_H #define GCC_VERIFY_H -#ifdef __cplusplus -extern "C" -{ -#endif - #include "system.h" #include "coretypes.h" #include "jcf.h" @@ -155,8 +151,4 @@ int verify_method (vfy_method *meth); -#ifdef __cplusplus -} -#endif - #endif /* ! GCC_VERIFY_H */ |
|
|
Re: PATCH RFA: Remove extern "C" from java header fileOn Tue, Jun 9, 2009 at 9:58 PM, Ian Lance Taylor<iant@...> 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. Thanks, Andrew Pinski |
|
|
Re: PATCH RFA: Remove extern "C" from java header fileAndrew Pinski <pinskia@...> writes:
> On Tue, Jun 9, 2009 at 9:58 PM, Ian Lance Taylor<iant@...> 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. Ian |
|
|
Re: PATCH RFA: Remove extern "C" from java header fileOn Wed, Jun 10, 2009 at 3:29 AM, Ian Lance Taylor<iant@...> wrote:
> Andrew Pinski <pinskia@...> writes: > >> On Tue, Jun 9, 2009 at 9:58 PM, Ian Lance Taylor<iant@...> 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. I think this is just a hangover from when the verifier was originally ported from the C++ version in the runtime. I can't think of a reason to have it - the verifier implementation is not actually shared between the front end and the runtime, so it can be removed. Bryce |
|
|
Re: PATCH RFA: Remove extern "C" from java header fileBryce McKinlay wrote:
> > I think this is just a hangover from when the verifier was originally > ported from the C++ version in the runtime. I can't think of a reason > to have it - the verifier implementation is not actually shared > between the front end and the runtime, so it can be removed. Thanks for the reminder. I agree, the patch is fine. Andrew. |
| Free embeddable forum powered by Nabble | Forum Help |