This is the mail archive of the gcc-patches@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: [PLUGINS] Add 'extern "C"' wrappers to several header files


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


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