[PATCH] D59402: Fix-it hints for -Wmissing-{prototypes,variable-declarations}

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 19:22:06 PDT 2019


aaronpuchert added inline comments.


================
Comment at: test/Sema/warn-missing-prototypes.c:7
 int f(int x) { return x; } // expected-warning{{no previous prototype for function 'f'}}
+// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:1}:"static "
 
----------------
Maybe there shouldn't be a fix-it here, as there is a declaration, which is just not a prototype.


================
Comment at: test/Sema/warn-missing-prototypes.c:17-18
 
+extern int g3(int x) { return x; } // expected-warning{{no previous prototype for function 'g3'}}
+// CHECK-NOT: fix-it:"{{.*}}":{[[@LINE-1]]{{.*}}}:"{{.*}}"
+
----------------
As I wrote in the commit message: this could be fixed by replacing `extern` with `static`, but I don't think we have the `SourceLocation` for the storage class specifier available where the warning is emitted. Maybe I'm overlooking something though.


Repository:
  rC Clang

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

https://reviews.llvm.org/D59402





More information about the cfe-commits mailing list