[PATCH] D122983: [C11/C2x] Change the behavior of the implicit function declaration warning

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 4 08:30:31 PDT 2022


aaron.ballman marked 2 inline comments as done.
aaron.ballman added a comment.

In D122983#3426261 <https://reviews.llvm.org/D122983#3426261>, @erichkeane wrote:

> I don't have any real comments (the changes are quite trivial), and I really like the approach here, I think it is more than generous.  I see the transition of 
> C89/C99: Warn
> C11/C17: Warn-as-default-error
> C2x: Hard error
>
> as a really gentle and explainable behavior, its just a shame it took us this long to do so.

Thanks!

> I DO see that there are a ton of AArch64 Intrin tests that seem to have the same problems here (in Pre-commit-CI), that will need this change too, though they are questionably written.  I might suggest just adding the -std=c99 flag to all of those.  Attn: @paulwalker-arm @MattDevereau @david-arm @sdesmalen

Yeah, those tests seem to be overly-constraining. There's no reason to be validating whether there's an implicit function declaration warning in a *codegen* test. I will change all of those AAarch64 tests to require -std=c99 explicitly whenever possible, remove the `-verify` flag because there's no reason for a codegen test to verify diagnostic behavior that isn't generated by the CodeGen library, and remove the `// expected-warning` comments. I plan to do that as an NFC change that I'll land outside of this patch, unless any of the AArch64 folks speak up pretty quickly.



================
Comment at: clang/docs/ReleaseNotes.rst:114
+- The ``-Wimplicit-function-declaration`` warning diagnostic now defaults to
+  emitting an error (which can be downgraded with ``-Wno-error``) in C11 and
+  C17 mode. This is because the feature was removed in C99 and cannot be
----------------
erichkeane wrote:
> xbolva00 wrote:
> > I would mention explicitly  -Wno-error= implicit-function-declaration as -Wno-error is a big hammer.
> I think this is a valuable change, as suggested by @xbolva00 
Agreed!


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

https://reviews.llvm.org/D122983



More information about the cfe-commits mailing list