[PATCH] D124258: [C89/C2x] Change the behavior of implicit int diagnostics

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 16:47:13 PDT 2022

rsmith added inline comments.

Comment at: clang/docs/ReleaseNotes.rst:168-169
+  ``-Wno-error=implicit-int``, or disabled entirely with ``-Wno-implicit-int``.
+  As of C2x, support for implicit int has been removed, and the warning options
+  will have no effect. Specifying ``-Wimplicit-int`` in C89 mode will now issue
+  warnings instead of being a noop.
aaron.ballman wrote:
> rsmith wrote:
> > Is there some fundamental reason why implicit int is harder to support in C2x (as there was for implicit function declarations, because unprototyped functions are gone), or are we merely taking the opportunity to do this because C2x is new? I find the former more easily defensible than the latter, but I suppose the fact that we removed implicit function declarations means that C2x is the first really properly breaking change that C has had, so maybe now is the time regardless.
> Purely the latter -- C2x didn't make anything harder here. However, I'd like to position C23 as "not your grandfather's C" in Clang by strengthening diagnostics, especially ones related to safety or security vulnerabilities. Basically, I think it's time to cut ties with as many dangerous things that have been excised from C as possible. I think implicit int fits that goal in the same way that implicit function decls do (namely, the implicit choice can be wrong and you get surprising silent breakage at runtime if you're lucky).
> (FWIW, I'm also hoping to get these sort of changes lumped into Clang 15 so that the pain of upgrading is more localized to just one release rather than strung out over several.)
OK. I wonder our stricter interpretation of the rules in C23 onwards is something we should be calling out in our documentation as policy?



More information about the cfe-commits mailing list