[patch]: Add to i386 intrinsic headers extern "C" blocks for C++ case

Kai Tietz ktietz70@googlemail.com
Mon Mar 1 19:10:00 GMT 2010


2010/3/1 Dave Korn <dave.korn.cygwin@googlemail.com>:
> On 01/03/2010 18:11, Kai Tietz wrote:
>> 2010/3/1 H.J. Lu <hjl.tools@gmail>:
>>> On Mon, Mar 1, 2010 at 9:53 AM, Kai Tietz <ktietz70@googlemail> wrote:
>
>>>> I had recently an user-report that there are problems to include gcc's
>>>> intrinsic header in c++. Those problems were reasoned by missing
>>>> extern C in those headers.
>>>>
>>> I may have missed something. All those functions have
>>>
>>> extern __inline unsigned short __attribute__((__gnu_inline__,
>>> __always_inline__, __artificial__))
>>>
>>> Why do they need "extern C"?
>
>> I got this issue reported by a guy building Qt 4.7 for x64 and x86
>> windows. I assume (I just sent an request to him for showing me the
>> failures he gets), that extern in C++ isn't the same as extern "C". At
>> least the name decoration should be different here and this already
>> could be here the issue.
>
>  But they should always be inlined and never externally visible at link-time
> anyway.  So if there's any bug, it's an inlining failure, not a linkage-type
> problem.
>
>    cheers,
>      DaveK
>
>

Well, the functions in gcc's intrinsic functions are always inlined,
but an intrinsic can be present as implementation, too. Eg for Win32
targets, InterLocked... functions are intrinsic and in general inline,
but there are also implementation functions present (see Kern32l for
example).
If somebody would use -fno-builtins, then those functions have to be
present as implementation, too (this option is in general for most
targets not usable, as for most intrinsic functions there is no
implementation in any library present).
By closer inspection the issue here is, that for win32 the intrinsic
functions of win32 having C scope definition (see description about
intrin.h) and here this issue is raised.
As I talked already on IRC to Jason, he agrees that it could be in
general a good thing to use a unique scope for those functions. At
least it would allow that some of them can be implemented just once
for a runtime, if necessary.

Regards,
Kai

-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination



More information about the Gcc-patches mailing list