On Tue, Nov 1, 2016 at 4:00 PM, Bernd Edlinger
<bernd.edlin...@hotmail.de> wrote:
> On 11/01/16 20:48, Jason Merrill wrote:
>>>>>>>           else if ((DECL_EXTERN_C_P (newdecl)
>>>>>>>                     && DECL_EXTERN_C_P (olddecl))
>>>>>>>                    || compparms (TYPE_ARG_TYPES (TREE_TYPE (newdecl)),
>>>>>>>                                  TYPE_ARG_TYPES (TREE_TYPE (olddecl))))
>>>>
>>>> So I was thinking to drop the "else" and the compparms test.
>>>
>>> Yes.  But then we must somehow avoid:
>>>
>>>            else
>>>              /* Discard the old built-in function.  */
>>>              return NULL_TREE;

>>> It maybe easier, just to copy the warning to the DECL_ANTICIPATED case?
>>
>> Or even move it there; removing the existing warning doesn't change
>> anything in the testsuite, and I'm having trouble imagining how to
>> trigger it.
>>
>
> Nice.  It must be something, which does not anticipate a declaration.
>
> like:
>
> cat test.cc
> int __builtin_abort(void*);
>
> g++ -c test.cc
> test.cc:1:5: warning: new declaration 'int __builtin_abort(void*)'
> ambiguates built-in declaration 'void __builtin_abort()'
>   int __builtin_abort(void*);
>       ^~~~~~~~~~~~~~~
>
> Intersting, the warning comes even though I forgot to add the
> extern "C".

Looks like anything starting with __builtin is implicitly extern "C"
(set in grokfndecl).

If we remove the DECL_ANTICIPATED check, I see some failures in
builtin* tests due to missing extern "C".  That seems appropriate at
file scope, but I'm not sure it's right for namespace std.

Jason

Reply via email to