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

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 30 15:58:45 PDT 2021


dblaikie added a comment.

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:
>
>   $ cat foo.c
>   int page;
>   int put_page_testzero(int);
>   void foo (void) {
>     int zeroed;
>     zeroed = put_page_testzero(page);
>     ((void)(sizeof(( long)(!zeroed))));
>   }
>   $ clang -c -Wall foo.c
>   foo.c:4:7: warning: variable 'zeroed' set but not used [-Wunused-but-set-variable]
>     int zeroed;
>         ^

Any idea what the purpose of this code is/why it's not a reasonable thing to warn on?


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