[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
Fri Apr 15 04:51:29 PDT 2022


aaron.ballman added a comment.

In D122983#3452994 <https://reviews.llvm.org/D122983#3452994>, @rsmith wrote:

> In D122983#3451920 <https://reviews.llvm.org/D122983#3451920>, @erichkeane wrote:
>
>> I think Aaron's approach provides a proper 'depreciation' period in our compiler, as best as we have the ability to do.
>
> We've been warning by default for a decade that this code is not valid in C99; that was our deprecation period.

I thought about this perspective a bunch overnight and I think I agree that this is reasonable given that the warning explicitly calls the code out as being *invalid*.

> If the aim is to provide a deprecation period, the end goal should be that in some future Clang version we complete the transition and change the C99 default to reject too. Otherwise, that's not a deprecation period, that's a permanent language extension in our C99 mode -- and it seems capricious to provide that extension by default in C99 mode but not C11 / C17 mode. Given that this extension is, well, bad, I think we shouldn't be providing it by default anywhere. It's not hard for people to turn the warning flag off, and people intentionally using this in C99 onwards probably already have done so.

FWIW, I misunderstood your original suggestion:

> I think we should just make this an error by default in C99 onwards;

I thought you meant this should be an *error* (not a warning defaulting to an error) in C99 and later. That would be too aggressive of an approach for me to support because it gives no upgrade path to users to easily get onto Clang 15. Now that I understand you better, I like your approach and rationale.


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

https://reviews.llvm.org/D122983



More information about the cfe-commits mailing list