[PATCH] D66919: Warn about zero-parameter K&R definitions in -Wstrict-prototypes
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 28 18:45:10 PDT 2019
dexonsmith added a reviewer: erik.pilkington.
dexonsmith added a comment.
This could cause a lot of churn in existing projects (especially with `static void foo()`), without giving Clang any new information. I'm wary of this.
> Zero-parameter K&R definitions specify that the function has no
> parameters, but they are still not prototypes, so calling the function
> with the wrong number of parameters is just a warning, not an error.
Why not just directly give an error for the problematic case? We could carve out a `-W` flag (if it doesn't already exist) that warns if you incorrectly pass parameters to a function whose definition has no prototype, and then make it `-Werror`-by-default.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66919/new/
https://reviews.llvm.org/D66919
More information about the cfe-commits
mailing list