[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable
Dávid Bolvanský via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 1 22:29:59 PDT 2021
xbolva00 added a comment.
In D100581#2792854 <https://reviews.llvm.org/D100581#2792854>, @Abpostelnicu wrote:
> I think there is a false positive with this @george.burgess.iv:
> In this <https://searchfox.org/mozilla-central/source/mozglue/baseprofiler/core/platform-linux-android.cpp#222-227> we have the warning triggered:
> mozglue/baseprofiler/core/platform-linux-android.cpp:216:9: error: variable 'r' set but not used [-Werror,-Wunused-but-set-variable]
>
> SigHandlerCoordinator() {
> PodZero(&mUContext);
> int r = sem_init(&mMessage2, /* pshared */ 0, 0);
> r |= sem_init(&mMessage3, /* pshared */ 0, 0);
> r |= sem_init(&mMessage4, /* pshared */ 0, 0);
> MOZ_ASSERT(r == 0);
> }
If MOZ_ASSERT is expanded to nothing, than the warning is correct. (void)r; trick should work here..
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100581/new/
https://reviews.llvm.org/D100581
More information about the llvm-commits
mailing list