[PATCH] D116635: Add warning to detect when calls passing arguments are made to functions without prototypes.

Dan Liew via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 5 14:39:03 PST 2022


delcypher added inline comments.


================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5530
+  "calling function %0 with arguments when function has no prototype">, InGroup<
+  DiagGroup<"strict-calls-without-prototype">>, DefaultIgnore;
 def warn_missing_variable_declarations : Warning<
----------------
fcloutier wrote:
> sp: I think this should be called "strict-call-without-prototype" (singular call) as most warning flag names seem to prefer singulars.
@fcloutier 
I'm open to renaming the warning. I originally made the warning plural because there were warnings near by that used it. E.g.

* `missing-variable-declarations`
* `strict-prototypes`
* `missing-prototypes`

If no one else chimes in I'll make it singular.

Also, do you think we should drop the "strict" prefix? I.e. `call-without-prototype` instead of `strict-call-without-prototype`. The reason I'm thinking that using `strict` might be a bad idea is:

1. The warning isn't actually strict. A strict version of the warning would warn on **all calls to functions without prototypes**. We've decided to only warn on calls with arguments to avoid noisy warnings that result from people frequently forgetting to explicitly mark functions as taking no arguments.

2. Calling this warning  `strict-call-without-prototype` precludes from adding a stricter version of warning in the future (i.e. we'd be force to name it something like `strict-strict-call-without-prototype` which is super confusing).

3. The intention in a future patch is to enable the warning by default. It seems odd to have a "strict" warning on by default given that there is precedence for doing the opposite (e.g. `-Wstrict-prototypes` is off by default).



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D116635



More information about the cfe-commits mailing list