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

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Jun 15 20:57:00 GMT 2012


On Fri, Jun 15, 2012 at 3:31 PM, Ian Lance Taylor <iant@google.com> wrote:
> Gabriel Dos Reis <gdr@integrable-solutions.net> writes:
>
>> On Fri, Jun 15, 2012 at 2:17 PM, Ian Lance Taylor <iant@google.com> wrote:
>>> Gabriel Dos Reis <gdr@integrable-solutions.net> 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.
>>
>> Hmm... could you elaborate on checking for ENABLE_BUILD_WITH_CXX as
>> opposed to just checkin __cpluscplus ?
>
> 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,
> but that seems odd.
>
> Ian

I guess the issue is when people care only about C plugins, yet fancy_abort
get implicitly exported with a C++ linkage.

I suspect this goes back to the eternal question: what do we consider as
part of the public GCC public API (no, Basile, I am not suggesting to have
the same discussion again.)

-- Gaby



More information about the Gcc-patches mailing list