[PATCH] D122895: [C89/C2x] Improve diagnostics around strict prototypes in C

Duncan P. N. Exon Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 14:27:39 PDT 2022


dexonsmith added subscribers: steven_wu, rjmccall, rnk, dexonsmith.
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}}
   };
----------------
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)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D122895



More information about the cfe-commits mailing list