[PATCH] D66919: Warn about zero-parameter K&R definitions in -Wstrict-prototypes

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 14 10:03:29 PST 2020


aaronpuchert added inline comments.


================
Comment at: clang/test/Sema/warn-strict-prototypes.c:11
+// function definition with 0 params, no prototype.
+void foo1() {} // expected-warning {{this old-style function definition is not preceded by a prototype}}
+// function definition with 0 params, prototype.
----------------
aaron.ballman wrote:
> I'd like a few more test cases:
> ```
> // Test that a non-prototyped definition with no preceding prototype whines about lacking a preceding prototype
> void fooN() {} // expected-warning {{this old-style function definition is not preceded by a prototype}}
> 
> // Test that an existing declaration with no prototype still warns that a corresponding definition with a type list is still not preceded by a prototype.
> void fooN1(); // expected-warning {{this function declaration is not a prototype}}
> void fooN1(void) {} // expected-warning {{this old-style function definition is not preceded by a prototype}}
> ```
I guess we want the warning only on the declaration of `fooN1`, not the definition? Because that's not an old-style function definition.


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