[PATCH] D123456: [C89/C2x] Diagnose calls to a function without a prototype but passes arguments

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 12 07:42:19 PDT 2022


aaron.ballman added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:126
+  a prototype will change behavior in C2x. Additionally, it will diagnose calls
+  to a function without a prototype but arguments are provided, only so long as
+  the ``-Wdeprecated-non-prototype`` option is enabled at the function
----------------
erichkeane wrote:
> This reads awkwardly to me...   Maybe something like?
> 
> Additionally, it will diagnose calls with provided arguments to a function without a prototype.  This warning is enabled only when the ``-Wdeprecated-non-prototype`` option is enabled at the function declaration, which allows a developer to disable the diagnostic for all callers at the point of declaration.
Oh, this is much better, thank you!


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5558
+def warn_strict_uses_without_prototype : Warning<
+  "calling %select{a function|%1}0 with arguments when the function has no "
+  "prototype">, InGroup<DeprecatedNonPrototype>;
----------------
erichkeane wrote:
> perhaps:
> 
> "function %select{|%1}0 without prototype called with arguments specified"
> 
> or something like that?
After some off-list discussion, we landed on some new wording here that better describes the issue with the user's code instead of just describing what the user's code does and hoping they infer the issue from there. :-D


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

https://reviews.llvm.org/D123456



More information about the cfe-commits mailing list