[PLUGINS] Add 'extern "C"' wrappers to several header files

Paolo Bonzini bonzini@gnu.org
Wed Jul 22 19:04:00 GMT 2009


On 07/22/2009 07:46 PM, Gabriel Dos Reis wrote:
> On Wed, Jul 22, 2009 at 12:01 PM, Paolo Bonzini<bonzini@gnu.org>  wrote:
>
>> You can do this: add a #define (via configure.ac) when building with
>> --enable-build-with-cxx, like AC_DEFINE([GCC_BUILT_WITH_CXX]), and use
>>
>> #include "config.h"
>> #if defined __cplusplus&&  !defined GCC_BUILT_WITH_CXX
>> extern "C" {
>> #endif
>>
>> ...
>>
>> #if defined __cplusplus&&  !defined GCC_BUILT_WITH_CXX
>> }
>> #endif
>
> I believe it is a mistake to build with a C++ compiler and decide NOT to take
> advantage of the additional checking of function calls.

Yes, the above sketch would do what you said: "undo" Duncan's patch if 
GCC was built with a C++ compiler.

Paolo



More information about the Gcc-patches mailing list