[PATCH] D122271: [Clang] -Wunused-but-set-variable warning - handle also pre/post unary operators
Dávid Bolvanský via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 28 22:51:56 PDT 2022
xbolva00 added a comment.
In D122271#3413193 <https://reviews.llvm.org/D122271#3413193>, @uabelho wrote:
> Hi,
>
> I noticed these to warning when compiling libunwind/src/UnwindLevel1.c with this patch:
>
> 00:22:48 /repo/bbiswjenk/fem2s10-eiffel176/workspace/llvm/sdk_1_20_ki_dev_test/libunwind/src/UnwindLevel1.c:175:12: warning: variable 'framesWalked' set but not used [-Wunused-but-set-variable]
> 00:22:48 unsigned framesWalked = 1;
> 00:22:48 ^
> 00:22:48 /repo/bbiswjenk/fem2s10-eiffel176/workspace/llvm/sdk_1_20_ki_dev_test/libunwind/src/UnwindLevel1.c:293:12: warning: variable 'framesWalked' set but not used [-Wunused-but-set-variable]
> 00:22:48 unsigned framesWalked = 1;
> 00:22:48 ^
> 00:22:48 2 warnings generated.
In D122271#3413193 <https://reviews.llvm.org/D122271#3413193>, @uabelho wrote:
> Hi,
>
> I noticed these to warning when compiling libunwind/src/UnwindLevel1.c with this patch:
>
> 00:22:48 /repo/bbiswjenk/fem2s10-eiffel176/workspace/llvm/sdk_1_20_ki_dev_test/libunwind/src/UnwindLevel1.c:175:12: warning: variable 'framesWalked' set but not used [-Wunused-but-set-variable]
> 00:22:48 unsigned framesWalked = 1;
> 00:22:48 ^
> 00:22:48 /repo/bbiswjenk/fem2s10-eiffel176/workspace/llvm/sdk_1_20_ki_dev_test/libunwind/src/UnwindLevel1.c:293:12: warning: variable 'framesWalked' set but not used [-Wunused-but-set-variable]
> 00:22:48 unsigned framesWalked = 1;
> 00:22:48 ^
> 00:22:48 2 warnings generated.
A warning was improved so fires more often.
Clearly, sometimes in __unw_phase2_resume, “fn” is ignored (so passed framesWalked is throw away as well). I see nothing wrong to warn here.
(void)framesWalked; will silence it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122271/new/
https://reviews.llvm.org/D122271
More information about the cfe-commits
mailing list