This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, C++] Warn on redefinition of builtin functions (PR c++/71973)


On Tue, Nov 1, 2016 at 2:15 PM, Bernd Edlinger
<bernd.edlinger@hotmail.de> wrote:
> On 11/01/16 18:11, Jason Merrill wrote:
>> On Tue, Nov 1, 2016 at 11:45 AM, Bernd Edlinger
>> <bernd.edlinger@hotmail.de> wrote:
>>> On 11/01/16 16:20, Jason Merrill wrote:
>>>> On 10/17/2016 03:18 PM, Bernd Edlinger wrote:
>>>> I'm not even sure we need a new warning.  Can we combine this warning
>>>> with the block that currently follows?
>>>
>>> After 20 years of not having a warning on that,
>>> an implicitly enabled warning would at least break lots of bogus
>>> test cases.
>>
>> Would it, though?  Which test cases still break with the current patch?
>
> Less than before, but there are still at least a few of them.
>
> I can make a list and send it tomorrow.
>
>>> Of course in C we have an implicitly enabled warning,
>>> so I would like to at least enable the warning on -Wall, thus
>>> -Wshadow is too weak IMO.
>>
>> Right.  The -Wshadow warning is for file-local declarations, so that
>> doesn't apply to your testcase; I was thinking that we should hit the
>> first (currently unconditional) warning.
>>
>>>>>           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.

Jason


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]