[PATCH] D123955: [C2x] Disallow functions without prototypes/functions with identifier lists

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 12:53:47 PDT 2022


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


================
Comment at: clang/lib/Basic/LangOptions.cpp:119
   Opts.Digraphs = Std.hasDigraphs();
+  Opts.StrictPrototypes = Std.isCPlusPlus() || Std.isC2x();
 
----------------
cor3ntin wrote:
> Stupid question, we probably don't want -fno-strict-prototype` to have an effect in  C++. is there something to deal with that? I'm not familiar with the option system
I don't currently expose a user-facing option for this yet. I was thinking about it, but wasn't certain if `-Werror=deprecated-non-prototype` was sufficient or not.

That said, if I did produce a user-facing option, I would not expose an `-fno-strict-prototype` option at all. Users can opt into strict prototypes, but they cannot opt out of them.


================
Comment at: clang/lib/Sema/SemaType.cpp:5299
+                  ? Context.getFunctionNoProtoType(T, EI)
+                                         : Context.IntTy;
           break;
----------------
cor3ntin wrote:
> can you explain the `Context.IntTy` here ?
It's our default fallback type -- we use the same thing on line 5120 as an example. It shouldn't matter overly much as we tell the declarator that it has an invalid type.


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

https://reviews.llvm.org/D123955



More information about the cfe-commits mailing list