[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
Sat Apr 30 07:04:56 PDT 2022

aaron.ballman marked an inline comment as done.
aaron.ballman added inline comments.

Comment at: clang/lib/Sema/SemaDecl.cpp:15319-15321
   // OpenCL v2.0 s6.9.u - Implicit function declaration is not supported.
   else if (getLangOpts().OpenCL)
     diag_id = diag::err_opencl_implicit_function_decl;
aaron.ballman wrote:
> rsmith wrote:
> > Should we even be calling this function in OpenCL mode? It seems a bit inconsistent that we avoid calling this in C++ and C2x mode, and that we call it but error in OpenCL mode.
> > 
> > Maybe there should be a function on `LangOptions` to ask if implicit function declarations are permitted in the current language mode, to make it easy to opt out the right cases? (Happy for this to be a follow-on change if you agree.)
> I agree that it does seem inconsistent. I can look into making that change in a follow-up.
I've fixed that up in a9d68a5524dea113cace5983697786599cbdce9a, thanks for the suggestion!

  rG LLVM Github Monorepo



More information about the cfe-commits mailing list