[PATCH] D100581: [Clang] -Wunused-but-set-parameter and -Wunused-but-set-variable
Arthur Eubanks via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 27 08:16:27 PDT 2021
aeubanks added a comment.
In D100581#2718947 <https://reviews.llvm.org/D100581#2718947>, @Abpostelnicu wrote:
> I think this added a regression, where you have this context:
>
> uint32_t LocalAccessible::SelectedItemCount() {
> uint32_t count = 0;
> AccIterator iter(this, filters::GetSelected);
> LocalAccessible* selected = nullptr;
> while ((selected = iter.Next())) ++count;
>
> return count;
> }
>
>
>
> [task 2021-04-27T02:39:42.523Z] 02:39:42 ERROR - /builds/worker/checkouts/gecko/accessible/generic/LocalAccessible.cpp:2455:20: error: variable 'selected' set but not used [-Werror,-Wunused-but-set-variable]
> [task 2021-04-27T02:39:42.523Z] 02:39:42 INFO - LocalAccessible* selected = nullptr;
> [task 2021-04-27T02:39:42.523Z] 02:39:42 INFO - ^
> [task 2021-04-27T02:39:42.523Z] 02:39:42 INFO - 1 error generated.
>
> The file in cause is this <https://searchfox.org/mozilla-central/source/accessible/generic/LocalAccessible.cpp#2455> one.
>
> Indeed the value stored in `selected` is not used but this check is a little bit too strict.
That seems like a real finding to me, deleting `selected` should fix it and clean up the code.
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