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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 07:43:51 PDT 2022


aaron.ballman added a comment.

In D122895#3511632 <https://reviews.llvm.org/D122895#3511632>, @jyknight wrote:

> The warnings for this case aren't great:
>
>   int foo();
>   
>   int
>   foo(int arg) {
>     return 5;
>   }

Yeah, that's not ideal, I'm looking into it to see if I can improve that scenario or not. Thankfully, IMO, such code is likely to be extremely rare. Most people writing that declaration either expect an arbitrary number of args (they really don't want the prototype) and so the definition is extremely suspect that it only accepts one, or they wrote the declaration assuming it would accept *no* args (the C++ behavior) and then the definition becomes flat-out a bug. Do you have evidence this code pattern appears with some frequency?


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