aaron.ballman added a comment.

In D123627#3707789 <https://reviews.llvm.org/D123627#3707789>, @aaron.ballman 
wrote:

> In D123627#3707635 <https://reviews.llvm.org/D123627#3707635>, @efriedma 
> wrote:
>
>> If the declaration we're redeclaring is a builtin, should the diagnostic be 
>> in the "-Wincompatible-library-redeclaration" warning group?  With this 
>> patch, we treat redefinitions of builtins without a prototype differently 
>> from redefinitions with a prototype, for example:
>>
>>   void acos() {} // error
>>   void acos(void) {} // warning
>>
>> Just ran into some code in Android which is using the first form.
>
> Er, I keep going back and forth on it. My initial inclination is that this is 
> closing a hole where we would incorrectly decide that these function 
> signatures are compatible enough to merge together when that's not the case, 
> so an error is appropriate. But the same can be said for redeclaring a 
> builtin with an incorrect prototype rather than declaring it without any 
> prototype. Given that these builtins are declared for the user automagically, 
> I think I come down on this being a case we'd rather warn instead of err. 
> It'd be weird to allow the user to define `void printf(void) {}` but not 
> `void printf();` (except in C2x mode).
>
> If we make a change here, I think it'd be good to get it done for Clang 15. 
> I'm not certain I've got the bandwidth to make this change in that timeframe 
> though (I can hopefully start on this sometime this week, but I have prior 
> commitments with deadlines that take priority).

I filed https://reviews.llvm.org/D131499 for this.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D123627/new/

https://reviews.llvm.org/D123627

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to