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

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 14 07:53:25 PDT 2022


erichkeane added a comment.

FWIW, Aaron and I discussed this at length while he was preparing this patch.  I think the current behavior (warn in C99, warn-as-error in C11/C17, hard error in C20) is about as aggressive as I'd want us to be with erroring without causing extensive heartache on our users. WG14 did us no favors here in 1999, and our delay on making this an error for 20 years since then has created an environment where I wish for us to be somewhat understanding of our users.  If you'd asked me in 1998 of course my answer would have been different.

I think Aaron's approach provides a proper 'depreciation' period in our compiler, as best as we have the ability to do.  I consider MOST projects who use C99 to be 'legacy' code bases with little maintenance, so introducing new errors to them would be unfortunate (even default-W-as-E). I see value to still warning in the C99 case, as it _IS_ a good improvement for anyone going through the source code trying to do small improvements, but a default-W-as-E causes greater overhead in that case.

Comparatively, I see projects using C11/C17 to be 'modern' or 'maintained' code bases, so the disable-able error seems to me to be a proper 'kick' to let them know this is something they need to change ASAP.  I would be VERY against this being 'just a warning' though, as they are more simply/commonly ignored, and makes the hard-error in C20 that much more jarring.

While I agree this is quite a odd of a transition, I see it as the most-gentle we can be for our users.  Anything 'more aggressive' in the C99/C11/C17 case would be an unfortunate burden, and anything 'less aggressive' would make the C20 change a further jarring/unfortunate burden.


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

https://reviews.llvm.org/D122983



More information about the cfe-commits mailing list