[PATCH] D79895: Add a new warning to warn when passing uninitialized variables as const reference parameters to a function
Hans Wennborg via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 23 06:21:52 PDT 2020
hans added a comment.
In D79895#2107604 <https://reviews.llvm.org/D79895#2107604>, @nick wrote:
> This diagnostic bring headaches because frequently `-Wunused-variable` suppression is done via no-op pseudo-consuming function like `boost::ignore_unused` <https://www.boost.org/doc/libs/1_73_0/libs/core/doc/html/core/ignore_unused.html>.
I haven't seen boost::ignore_unused before. In my experience, the idiomatic way of ignoring an unused variable in C/C++ is to cast it to void, as Arthur said.
> Particularly, it fires in Boost here https://github.com/boostorg/concept_check/blob/e69c81326d5a4359ac53f9c6fe53fc2baf24df50/include/boost/concept_check.hpp#L135-L141.
> Is it possible to make the diagnostic not fire for empty body consuming functions?
The combination of having an uninitialized variable and explicitly marking it unused like this seems to me like it would be unusual.
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