[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 12:15:42 PDT 2022


aaron.ballman added a comment.

In D122983#3454494 <https://reviews.llvm.org/D122983#3454494>, @jyknight wrote:

> In D122983#3454406 <https://reviews.llvm.org/D122983#3454406>, @aaron.ballman wrote:
>
>> In D122983#3452994 <https://reviews.llvm.org/D122983#3452994>, @rsmith wrote:
>>
>>> I think we should just make this an error by default in C99 onwards;
>>
>> Out of curiosity -- do you think we should remove the `DefaultIgnore` in C89 mode so that we warn by default there (perhaps as a follow up)? Also, I presume you expect `diag::ext_implicit_lib_function_decl` to behave the same way (warn in C89, warn-as-err in C99 and up) as part of this patch?
>
> I'm not sure what purpose it'd serve to change -std=c89 to be more strict at this point. It's not the default compilation mode, and the code is actually valid under that standard. IMO, adding such a on-by-default warning there would only serve to annoy folks explicitly trying to build super-old code with a super-old standards version.

Yeah, I was waffling on that one -- my thinking was that it would at least warn users that they're using something dangerous and we're going to break them if they attempt to upgrade (aka, we treat it as almost-deprecated in C89). But I'm fine leaving that one as `DefaultIgnore` too; as you say, if someone is in that mode explicitly, this IS a "feature" of that language.

I feel a bit more strongly that implicit builtins should be handled the same as other implicit functions (in terms of `DefaultError` behavior), unless there's some scenarios I'm not thinking of.


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

https://reviews.llvm.org/D122983



More information about the cfe-commits mailing list