[PATCH] D81444: Make the diagnostic-missing-prototypes put the suggested `static` in front of `const` if exists.

Vy Nguyen via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 9 14:21:29 PDT 2020


oontvoo marked 7 inline comments as done.
oontvoo added inline comments.


================
Comment at: clang/test/Sema/warn-missing-prototypes.c:62
+
+const struct MyStruct get_struct() { // expected-warning{{no previous prototype for function 'get_struct'}}
+                                     // expected-note at -1{{declare 'static' if the function is not intended to be used outside of this translation unit}}
----------------
gribozavr2 wrote:
> Did you mean to return a pointer to MyStruct? The top-level const is not meaningful.
No, I actually intended to test the top-level const. Though not being meaningful, it's still syntactically correct.
But now that you've mentioned it, I should add a test for  `MyStruct* ` too.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81444





More information about the cfe-commits mailing list