[all-commits] [llvm/llvm-project] 9955f1: [C2x] Disallow functions without prototypes/functi...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Wed Apr 20 10:28:58 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9955f14aaf9995f6f0f7bf058ac740463003c470
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-04-20 (Wed, 20 Apr 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/LangOptions.def
    M clang/include/clang/Basic/LangOptions.h
    M clang/include/clang/Driver/Options.td
    M clang/lib/AST/ASTContext.cpp
    M clang/lib/Parse/ParseDecl.cpp
    M clang/lib/Sema/SemaDecl.cpp
    M clang/lib/Sema/SemaType.cpp
    M clang/lib/StaticAnalyzer/Core/MemRegion.cpp
    A clang/test/Driver/no-knr-functions.c
    A clang/test/Frontend/no-knr-functions.c
    M clang/test/Parser/c2x-attributes.c
    A clang/test/Parser/c2x-func-prototype.c
    M clang/test/Sema/attr-c2x.c
    A clang/test/Sema/c2x-func-prototype.c
    M clang/www/c_status.html

  Log Message:
  [C2x] Disallow functions without prototypes/functions with identifier lists

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).

It also adds The -fno-knr-functions command line option to opt into
this behavior in other language modes.

Differential Revision: https://reviews.llvm.org/D123955

More information about the All-commits mailing list