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

Gregory Anders via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 28 12:45:08 PDT 2023


gpanders updated this revision to Diff 518024.
gpanders added a comment.

Remove cast to (void) in unused-expr.c

This cast is not necessary for this test, because foo does not have a
"warn_unused_result" attribute and is not marked const or pure. Removing the
cast improves the usefuless of the test as it verifies that there is no warning
issued in such a case (but a warning *would* be issued with
-Wunused-result-always, so this also acts as a "negative case" to ensure no
warning is issued when that flag is not present).


Repository:
  rG LLVM Github Monorepo

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

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-expr.c
  clang/test/Sema/unused-result-always.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149380.518024.patch
Type: text/x-patch
Size: 13254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230428/1fae94b1/attachment-0001.bin>


More information about the cfe-commits mailing list