[all-commits] [llvm/llvm-project] 33d3fc: [C89/C2x] Diagnose calls to a function without a p...

Aaron Ballman via All-commits all-commits at lists.llvm.org
Fri Apr 15 06:09:11 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 33d3fc4466479285121cbb1a62db249454da0bda
      https://github.com/llvm/llvm-project/commit/33d3fc4466479285121cbb1a62db249454da0bda
  Author: Aaron Ballman <aaron at aaronballman.com>
  Date:   2022-04-15 (Fri, 15 Apr 2022)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Basic/DiagnosticSemaKinds.td
    M clang/lib/Sema/SemaExpr.cpp
    M clang/test/Analysis/nullability.c
    M clang/test/Analysis/svalbuilder-float-cast.c
    M clang/test/Sema/warn-deprecated-non-prototype.c

  Log Message:
  -----------
  [C89/C2x] Diagnose calls to a function without a prototype but passes arguments

This catches places where a function without a prototype is
accidentally used, potentially passing an incorrect number of
arguments, and is a follow-up to the work done in
https://reviews.llvm.org/D122895 and described in the RFC
(https://discourse.llvm.org/t/rfc-enabling-wstrict-prototypes-by-default-in-c).
The diagnostic is grouped under the new -Wdeprecated-non-prototypes
warning group and is enabled by default.

The diagnostic is disabled if the function being called was implicitly
declared (the user already gets an on-by-default warning about the
creation of the implicit function declaration, so no need to warn them
twice on the same line). Additionally, the diagnostic is disabled if
the declaration of the function without a prototype was in a location
where the user explicitly disabled deprecation warnings for functions
without prototypes (this allows the provider of the API a way to
disable the diagnostic at call sites because the lack of prototype is
intentional).




More information about the All-commits mailing list