aaron.ballman added a comment.

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

> In D122895#3511646 <https://reviews.llvm.org/D122895#3511646>, @dexonsmith 
> wrote:
>
>>   void f1(void (^block)());
>>   
>>   void f2(void) {
>>     f1(^(int x) { /* do something with x */ });
>>   }
>
> Your code example is interesting though as I would expect that to trigger 
> `-Wdeprecated-non-prototype` as well as `-Wstrict-prototypes`. I'd expect the 
> pedantic warning to complain about the block declaration because it specifies 
> no prototype, and I'd expect the changes behavior warning because that code 
> will break in C2x.

I think the current behavior today makes sense but we should see if we can 
improve it to make *more* sense. With `-Wstrict-prototypes`, we should complain 
about the block without a prototype, but the use at the call site is not 
declaring a conflicting declaration nor is it a call to a function without a 
prototype but passes arguments (both of those are `-Wdeprecated-non-prototype` 
warnings). Instead, it's a new kind of situation that we may want to consider 
adding additional coverage for under `-Wdeprecated-non-prototype` based on the 
same reasoning we used for diagnosing calls to a function without a prototype 
but pass arguments. This is not specific to blocks, consider:

  void func(void (*fp)());
  void do_it(int i);
  
  int main(void) {
    func(do_it); // It'd be nice to diagnose this too, but we don't today
  }


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122895

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

Reply via email to