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

Nick Desaulniers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 16:52:55 PDT 2021


nickdesaulniers added a comment.

In D100581#2730760 <https://reviews.llvm.org/D100581#2730760>, @mbenfield wrote:

> In D100581#2730557 <https://reviews.llvm.org/D100581#2730557>, @nickdesaulniers wrote:
>
>> I see lots of instances from the kernel that look like this when reduced:
>
>
>
>> But adding a new warning flags to a handful of existing tests' RUN lines is unusual.
>
> These tests use `-Wall` for whatever reason, and they assign but don't use several variables, so we'll get warnings on them unless I add `-Wno-unused-but-set-variable`. Other alternatives:
>
> 1. add an expected-warning;
>
> 2. use a pragma to disable the warning;
>
> 3. put an `unused` attribute on the variables in question;
>
> 4. introduce an artificial use of these variables.
>
> I previously used item 1, but somebody earlier in an earlier comment requested that instead I add `-Wno-unused-but-set-variable` instead.

Ah, I missed that they were _disabling_ the warning; I was thinking they were _enabling_ it. Sorry for the noise; LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100581



More information about the cfe-commits mailing list