[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 09:48:41 PDT 2022


aaron.ballman marked 7 inline comments as done.
aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Basic/LangOptions.h:534
+  /// Returns true if implicit int is supported at all.
+  bool implicitIntEnabled() const { return !CPlusPlus && !C2x; }
+
----------------
cor3ntin wrote:
> erichkeane wrote:
> > aaron.ballman wrote:
> > > erichkeane wrote:
> > > > cor3ntin wrote:
> > > > > erichkeane wrote:
> > > > > > This name seems inverse of what you mean to me?  IDK if you're bike-shed-sniping me here, but:
> > > > > > 
> > > > > > `prohibitsImplicitInt` to be the reverse of above? It becomes SLIGHTLY ambiguous to me (in that we don't mean "the language standard prohibits", we mean "the compiler implementation prohibits"), but that can be fixed up with a comment.
> > > > > > 
> > > > > > If you want to keep the direction, perhaps `implicitIntPermitted`, at which point I might suggest the one above become `implicitIntRequired`.
> > > > > @erichkeane `requiresImplicitInt` is only used twice. Does it needs a name?
> > > > > 
> > > > *shrug*, I tend to be of the feeling that if you have to say something this often, and functions are basically free, mind as well make one.
> > > The idea here is that `requiresImplicitInt()` tells you when the support is mandatory per spec, and `implicitIntEnabled()` tells you when the support is either mandatory or an extension. I'm not strongly tied to the names, how do these sound?
> > > 
> > > `isImplicitIntRequired()` and `isImplicitIntAllowed()`?
> > > 
> > > (I could also add the word `Support` in there as in `isImplicitIntSupportRequired()` but then the function names start to get a bit longer than I think is reasonable.)
> > >> The idea here is that requiresImplicitInt() tells you when the support is mandatory per spec, and implicitIntEnabled() tells you when the support is either mandatory or an extension. I'm not strongly tied to the names, how do these sound?
> > 
> > Well, as it is now, the latter tells you whether 'it is allowed as an extension'.
> > 
> > 
> > >>`isImplicitIntRequired()` and `isImplicitIntAllowed()`?
> > 
> > These seem pretty clear to me.  I don't see 'Support' as being valuable.
> > 
> `implicitIntEnabled` makes sense to me. I guess my question is, is there precedence for options for language-mandated features?
> I guess my question is, is there precedence for options for language-mandated features?

Sure, though many of them also have user-facing command line flags to set the options. (wchar_t support, digraphs, etc)

I added these as helper functions mostly because there's no way to have language options whose default value is dependent on other language options.


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

https://reviews.llvm.org/D124258



More information about the cfe-commits mailing list