[PATCH] D66919: Warn about zero-parameter K&R definitions in -Wstrict-prototypes

Aaron Puchert via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 4 15:27:15 PDT 2019


aaronpuchert added a comment.

In D66919#1658355 <https://reviews.llvm.org/D66919#1658355>, @aaron.ballman wrote:

> We do have numerous warnings that are default errors, you can look for `DefaultError` in the diagnostic .td files to see the uses.


Thanks, I hadn't seen that before. It seems that most of these warnings are for extensions, but one comes pretty close to what @dexonsmith has suggested:

  def warn_cannot_pass_non_pod_arg_to_vararg : Warning<
    "cannot pass object of %select{non-POD|non-trivial}0 type %1 through variadic"
    " %select{function|block|method|constructor}2; call will abort at runtime">,
    InGroup<NonPODVarargs>, DefaultError;

The standard explicitly says in C11 6.5.2.2p8: “the number and types of arguments are not compared with those of the parameters in a function definition that does not include a function prototype declarator”, but perhaps this just means a programmer can't rely on such a check?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66919





More information about the cfe-commits mailing list