[PATCH] D125814: Fix strict prototype diagnostic wording for definitions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 17 12:35:37 PDT 2022


aaron.ballman added a comment.

In D125814#3520137 <https://reviews.llvm.org/D125814#3520137>, @jyknight wrote:

> This confuses me.
>
> Looking at behavior with default flags:
>
> We won't emit a -Wdeprecated-non-prototype warning for `int foo();`, until we subsequently find `int foo(int arg) { return 5; }`.

Close, but not quite. With default flags, we won't warn for `int foo();` until we see a subsequent `int foo(int arg)` (regardless of whether it's a declaration or a definition).

> Since we definitely have the context of what's going on at that point, in order to have determined that there's a conflict, what prevents doing the "right thing": emitting only 1 warning (at the definition site) and 1 note (at the declaration site)?

I'm going to continue to investigate; I recall arriving at this complex logic because I was trying to balance the deprecation warning diagnostics against the changes behavior diagnostics to keep the chattiness down. However, maybe this logic can now be simplified if I reword the diagnostic messages somewhat and rearrange some of the logic. I'll see what I can come up with.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D125814



More information about the cfe-commits mailing list