[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 22 17:12:48 PDT 2020


aeubanks added a comment.

In D79895#2107796 <https://reviews.llvm.org/D79895#2107796>, @nick wrote:

> > This warning can be turned off by the flag `-Wno-uninitialized-const-reference`.
>
> Suggesting to turn off the warning should be the last resort. I am pointing to the false positives for large existing code bases from `-Wall` diagnostic.
>
> > I don't think we can just make the diagnostic not fire for empty body consuming functions, if the function declaration and definition are in different translation units.
>
> I am talking about the particular situation that is involves only inline functions with empty bodies. `boost::ignore_unused`-like functions are obviously come with definition.


I feel like doing interprocedural analysis for this is overkill. What is the benefit of `boost::ignore_unused(foo);` rather than the more common `(void) foo;`? Any examples?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79895





More information about the cfe-commits mailing list