On Fri, Jun 15, 2012 at 4:48 AM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Fri, Jun 15, 2012 at 11:27 AM, Duncan Sands <baldr...@free.fr> wrote: >> 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. > > Uh, I don't think we should do that. Why do we include cstring here anyways?
Agreed. Including a standard header within a language specification is bogus. If <string.h> is needed, just include it as such. A standard header isn't under our control (whether C or C++ is used is immaterial); the whole justification of "don't want name mangling" is bogus. If a standard header isn't needed; it should not be included. -- Gaby