My plugin is written in C++. When including headers from gcc-4.6 it wraps them in 'extern "C"' to prevent name mangling. Some of the plugin headers include gcc/system.h which includes the C++ header cstring if it detects the use of a C++ compiler. As a result cstring routines included this way end up wrapped in 'extern C', while those included directly from C++ aren't 'extern C'. This doesn't worry g++, but clang gets upset, erroring out with a complaint about multiple inconsistent declarations of memchr and friends. Is the following patch OK to apply to gcc-4.6? And is it in principle OK to apply to gcc-4.7 (I didn't test it there yet)? It would be useful if gcc-4.7 is compiled as C.
Thanks, Duncan. Index: gcc/system.h =================================================================== --- gcc/system.h (revision 188518) +++ gcc/system.h (working copy) @@ -191,7 +191,9 @@ #endif #ifdef __cplusplus +extern "C++" { # include <cstring> +} #endif /* Some of glibc's string inlines cause warnings. Plus we'd rather