[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:16:07 PDT 2022


aaron.ballman created this revision.
aaron.ballman added reviewers: jyknight, eli.friedman, hubert.reinterpretcast, erichkeane, clang-language-wg.
Herald added subscribers: dexonsmith, jdoerfert, martong.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.

WG14 has elected to remove support for K&R C functions in C2x. The feature was introduced into C89 already deprecated, so after this long of a deprecation period, the committee has made an empty parameter list mean the same thing in C as it means in C++: the function accepts no arguments exactly as if the function were written with `(void)` as the parameter list.

This patch implements WG14 N2841 No function declarators without prototypes (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2841.htm)  and WG14 N2432 Remove support for function definitions with identifier lists (http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2432.pdf).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123955

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/LangOptions.def
  clang/lib/AST/ASTContext.cpp
  clang/lib/Basic/LangOptions.cpp
  clang/lib/Parse/ParseDecl.cpp
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaType.cpp
  clang/lib/StaticAnalyzer/Core/MemRegion.cpp
  clang/test/Parser/c2x-attributes.c
  clang/test/Parser/c2x-func-prototype.c
  clang/test/Sema/attr-c2x.c
  clang/test/Sema/c2x-func-prototype.c
  clang/tools/clang-import-test/clang-import-test.cpp
  clang/www/c_status.html

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123955.423446.patch
Type: text/x-patch
Size: 14334 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220418/b05f7570/attachment-0001.bin>


More information about the cfe-commits mailing list