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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 12:13:55 PDT 2022


aaron.ballman 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.
----------------
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.)


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

https://reviews.llvm.org/D124258



More information about the cfe-commits mailing list