[PATCH] D149380: [clang] Add -Wunused-result-always warning

Gregory Anders via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 14:11:03 PDT 2023


gpanders created this revision.
gpanders added a reviewer: theraven.
Herald added a project: All.
gpanders requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

This flag enables warnings for unused function return values
universally, even for functions which do not have a "warn_unused_result"
attribute.

This is disabled by default as it is far too noisy for most C/C++ code;
however, there are contexts where this is a desirable warning to have
(for example, in safety critical code where ignoring return values is
usually forbidden).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149380

Files:
  clang/include/clang/AST/Expr.h
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/AST/Expr.cpp
  clang/lib/Sema/SemaStmt.cpp
  clang/test/Sema/unused-result-always.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149380.517709.patch
Type: text/x-patch
Size: 12797 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230427/23527a61/attachment.bin>


More information about the cfe-commits mailing list