[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable

Michael Benfield via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 29 16:09:10 PDT 2021


mbenfield updated this revision to Diff 341695.
mbenfield added a comment.

Another try at these warnings, using the implementation strategy outlined by rsmith.

A couple other notes:

- At the moment I've removed these warnings from the diagnostic groups -Wextra

and -Wunused. It was suggested by aeubanks that the groups could be added in a
later commit, once these warnings have been determined to not be too
disruptive. Of course I can change this now if requested.

- I've just tried to mimic gcc's behavior as closely as possible, including not

warning if an assignment is used, and not warning on nonscalar types in C++
(except that in some cases gcc inexplicably does warn on nonscalar types; test
on the file vector-gcc-compat.c to compare... I haven't determined any
rationale to when it chooses to warn in these cases).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581

Files:
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaDecl.cpp
  clang/lib/Sema/SemaExpr.cpp
  clang/lib/Sema/SemaExprCXX.cpp
  clang/test/Sema/warn-unused-but-set-parameters.c
  clang/test/Sema/warn-unused-but-set-variables.c
  clang/test/SemaCXX/warn-unused-but-set-parameters-cpp.cpp
  clang/test/SemaCXX/warn-unused-but-set-variables-cpp.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100581.341695.patch
Type: text/x-patch
Size: 12615 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210429/4ba9ea90/attachment-0001.bin>


More information about the cfe-commits mailing list