dexonsmith added inline comments.
================ Comment at: clang/test/Sema/warn-strict-prototypes.m:20 + // know it's a block when diagnosing. + void (^block2)(void) = ^void() { // expected-warning {{a function declaration without a prototype is deprecated in all versions of C}} }; ---------------- dexonsmith wrote: > This is a definition, so the compiler knows that there are no parameters. Why > would we warn here? Reading > https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c/60521/18 > it looks to me like an example of what @rnk was referring to, about churning > code to add `(void)` and then return back to `()` later. > > (cc: @steven_wu and @rjmccall as well) Specifically, `^void() { /* anything */}` is the definition of a block with zero parameters. Maybe pedantically it's lacking a prototype, but the compiler knows (since this is the definition) how many parameters there are. (Same goes for `void() { /* anything */ }` at global scope; is that triggering `-Wstrict-prototypes` now too?) 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