aaron.ballman added a comment. In D66919#1651108 <https://reviews.llvm.org/D66919#1651108>, @dexonsmith wrote:
> In D66919#1650775 <https://reviews.llvm.org/D66919#1650775>, @aaron.ballman > wrote: > > > In D66919#1650174 <https://reviews.llvm.org/D66919#1650174>, @dexonsmith > > wrote: > > > > > 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. > > > > > > Those projects likely aren't aware they're using prototypeless functions, > > which are trivial to call incorrectly. I suspect this diagnostic will find > > real bugs in code. > > > To be clear, my understanding is that `-Wstrict-prototypes` already warns on > non-prototype declarations like this: > > void foo(); > > > we just don't warn on non-prototype defining declarations, where the meaning > is unambiguous: > > void foo() {} > There are two different warnings, and perhaps we're speaking about different ones. We have a warning about not having a prototype (warning: this function declaration is not a prototype) and we have a warning about not seeing a preceding prototype (warning: this old-style function definition is not preceded by a prototype). I think this patch deals with the latter. >> It's not incorrect to pass arguments to a function without a prototype, so >> that should not be an error. It is incorrect to pass the wrong number or >> types of arguments to a function without a prototype. It's not a bad idea to >> error in that circumstances, but there's no solution for `extern void foo()` >> where we don't see the actual definition. > > Given my understanding, then the only corner case that's left is when we *do* > see the definition. Yeah, and we already handle that situation with an un-ignorable warning: https://godbolt.org/z/TPklNE However, I think the inconsistency this patch is addressing is that we warn inconsistently here: https://godbolt.org/z/wvipEs I would expect the definition of `bar()` to warn similar to the definition of `foo()` for the same reasons that `foo()` is diagnosed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D66919/new/ https://reviews.llvm.org/D66919 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits