Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-18 Thread Gabriel Dos Reis
On Mon, Jun 18, 2012 at 4:18 AM, Richard Guenther wrote: > On Sun, Jun 17, 2012 at 2:56 PM, Gabriel Dos Reis > wrote: >> On Sun, Jun 17, 2012 at 6:55 AM, Richard Guenther >> wrote: >>> On Fri, Jun 15, 2012 at 5:18 PM, Gabriel Dos Reis >>> wrote: On Fri, Jun 15, 2012 at 10:13 AM, Duncan San

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-18 Thread Richard Guenther
On Sun, Jun 17, 2012 at 2:56 PM, Gabriel Dos Reis wrote: > On Sun, Jun 17, 2012 at 6:55 AM, Richard Guenther > wrote: >> On Fri, Jun 15, 2012 at 5:18 PM, Gabriel Dos Reis >> wrote: >>> On Fri, Jun 15, 2012 at 10:13 AM, Duncan Sands wrote: Hi Gabriel, >>> Richard just reminded me t

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-17 Thread Gabriel Dos Reis
On Sun, Jun 17, 2012 at 6:58 AM, Richard Guenther wrote: > On Sat, Jun 16, 2012 at 8:47 PM, Gabriel Dos Reis > wrote: >> On Sat, Jun 16, 2012 at 3:54 AM, Duncan Sands wrote: >>> Hi, >>> >>> > If ENABLE_BUILD_WITH_CXX is defined, then GCC itself is built with C++, > and we want a C++ sign

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-17 Thread Gabriel Dos Reis
On Sun, Jun 17, 2012 at 6:55 AM, Richard Guenther wrote: > On Fri, Jun 15, 2012 at 5:18 PM, Gabriel Dos Reis > wrote: >> On Fri, Jun 15, 2012 at 10:13 AM, Duncan Sands wrote: >>> Hi Gabriel, >>> >> Richard just reminded me that we have two fancy_aborts. >> Could you tell which one your c

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-17 Thread Richard Guenther
On Sat, Jun 16, 2012 at 8:47 PM, Gabriel Dos Reis wrote: > On Sat, Jun 16, 2012 at 3:54 AM, Duncan Sands wrote: >> Hi, >> >> If ENABLE_BUILD_WITH_CXX is defined, then GCC itself is built with C++, and we want a C++ signature for functions.  If it is not defined, then GCC itself is

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-17 Thread Richard Guenther
On Fri, Jun 15, 2012 at 5:18 PM, Gabriel Dos Reis wrote: > On Fri, Jun 15, 2012 at 10:13 AM, Duncan Sands wrote: >> Hi Gabriel, >> > Richard just reminded me that we have two fancy_aborts. > Could you tell which one your code is indirectly using? the one installed as p

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-16 Thread Gabriel Dos Reis
On Sat, Jun 16, 2012 at 3:54 AM, Duncan Sands wrote: > Hi, > > >>> If ENABLE_BUILD_WITH_CXX is defined, then GCC itself is built with C++, >>> and we want a C++ signature for functions.  If it is not defined, then >>> GCC itself is not built with C++, and we want (and must have) a C >>> signature.

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-16 Thread Duncan Sands
Hi, If ENABLE_BUILD_WITH_CXX is defined, then GCC itself is built with C++, and we want a C++ signature for functions. If it is not defined, then GCC itself is not built with C++, and we want (and must have) a C signature. I suppose we would decide that fancy_abort always uses a C signature, b

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 3:31 PM, Ian Lance Taylor wrote: > Gabriel Dos Reis writes: > >> On Fri, Jun 15, 2012 at 2:17 PM, Ian Lance Taylor wrote: >>> Gabriel Dos Reis writes: >>> What we can do is what I suggested in my last message: just give the language specification to the d

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Ian Lance Taylor
Gabriel Dos Reis writes: > On Fri, Jun 15, 2012 at 2:17 PM, Ian Lance Taylor wrote: >> Gabriel Dos Reis writes: >> >>> What we can do is what I suggested >>> in my last message: just give the language specification to the declarations >>> that matter in gcc/system.h. >> >> Sure, just have to ch

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 2:17 PM, Ian Lance Taylor wrote: > Gabriel Dos Reis writes: > >> What we can do is what I suggested >> in my last message: just give the language specification to the declarations >> that matter in gcc/system.h. > > Sure, just have to check #ifdef ENABLE_BUILD_WITH_CXX to

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Ian Lance Taylor
Gabriel Dos Reis writes: > What we can do is what I suggested > in my last message: just give the language specification to the declarations > that matter in gcc/system.h. Sure, just have to check #ifdef ENABLE_BUILD_WITH_CXX to know what specification to give. Ian

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 11:06 AM, Ian Lance Taylor wrote: > Richard Guenther writes: > >> Ian - you added this include in rev. 167764, I don't think that was "proper". >> But I'm not sure wrapping a system.h include inside extern "C" from a C++ >> plugin is proper either ... > > I did commit 1677

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Ian Lance Taylor
Richard Guenther writes: > Ian - you added this include in rev. 167764, I don't think that was "proper". > But I'm not sure wrapping a system.h include inside extern "C" from a C++ > plugin is proper either ... I did commit 167764 but I didn't write it. It's from http://gcc.gnu.org/ml/gcc-patc

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 10:13 AM, Duncan Sands wrote: > Hi Gabriel, > Richard just reminded me that we have two fancy_aborts. Could you tell which one your code is indirectly using? >>> >>> >>> >>> the one installed as plugin/include/system.h, which seems to be >>> gcc/include/system.h.

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
Hi Gabriel, Richard just reminded me that we have two fancy_aborts. Could you tell which one your code is indirectly using? the one installed as plugin/include/system.h, which seems to be gcc/include/system.h. OK. I think that declaration has to have the C language spec. Would you prepare

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 9:33 AM, Duncan Sands wrote: > Hi Gabriel, > > >> Richard just reminded me that we have two fancy_aborts. >> Could you tell which one your code is indirectly using? > > > the one installed as plugin/include/system.h, which seems to be > gcc/include/system.h. OK. I think t

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
Hi Gabriel, Richard just reminded me that we have two fancy_aborts. Could you tell which one your code is indirectly using? the one installed as plugin/include/system.h, which seems to be gcc/include/system.h. It is used for example in tree.h here: /* Advance to the next argument. */ static

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 9:18 AM, Duncan Sands wrote: > Hi Gabriel, > > >>> it defines fancy_abort.  Not wrapping system.h in extern C results in >>>  undefined symbol: _Z11fancy_abortPKciS0_ >>> when loading the plugin. >> >> >> If you want fancy_abort to have a C language specification, that is >

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 8:25 AM, Richard Guenther wrote: > On Fri, Jun 15, 2012 at 2:40 PM, Duncan Sands wrote: >> Hi Richard, >> >> >>> As system.h is supposed to only include system headers and do nothing >>> else it has to be prepared to be included from C++ already, so no extern >>> "C" >>> w

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
Hi Gabriel, it defines fancy_abort. Not wrapping system.h in extern C results in undefined symbol: _Z11fancy_abortPKciS0_ when loading the plugin. If you want fancy_abort to have a C language specification, that is what you should declare as such. my code isn't using fancy_abort directly,

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 7:40 AM, Duncan Sands wrote: > Hi Richard, > > >> As system.h is supposed to only include system headers and do nothing >> else it has to be prepared to be included from C++ already, so no extern >> "C" >> wrapping should be necessary for it. > > > it defines fancy_abort.  

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 4:59 AM, Duncan Sands wrote: > Hi Richard, > > >> Uh, I don't think we should do that.  Why do we include cstring here >> anyways? >> >> Ian - you added this include in rev. 167764, I don't think that was >> "proper". >> But I'm not sure wrapping a system.h include inside e

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Gabriel Dos Reis
On Fri, Jun 15, 2012 at 4:48 AM, Richard Guenther wrote: > On Fri, Jun 15, 2012 at 11:27 AM, Duncan Sands 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.

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Richard Guenther
On Fri, Jun 15, 2012 at 2:40 PM, Duncan Sands wrote: > Hi Richard, > > >> As system.h is supposed to only include system headers and do nothing >> else it has to be prepared to be included from C++ already, so no extern >> "C" >> wrapping should be necessary for it. > > > it defines fancy_abort.  

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
Hi Richard, As system.h is supposed to only include system headers and do nothing else it has to be prepared to be included from C++ already, so no extern "C" wrapping should be necessary for it. it defines fancy_abort. Not wrapping system.h in extern C results in undefined symbol: _Z11fanc

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Richard Guenther
On Fri, Jun 15, 2012 at 11:59 AM, Duncan Sands wrote: > Hi Richard, > > >> Uh, I don't think we should do that.  Why do we include cstring here >> anyways? >> >> Ian - you added this include in rev. 167764, I don't think that was >> "proper". >> But I'm not sure wrapping a system.h include inside

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
Hi Richard, Uh, I don't think we should do that. Why do we include cstring here anyways? Ian - you added this include in rev. 167764, I don't think that was "proper". But I'm not sure wrapping a system.h include inside extern "C" from a C++ plugin is proper either ... since the plugin needs

Re: [Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Richard Guenther
On Fri, Jun 15, 2012 at 11:27 AM, Duncan Sands 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

[Patch 4.6] In system.h, wrap include of C++ header in 'extern C++'

2012-06-15 Thread Duncan Sands
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