[PATCH] D152495: [Clang][SemaCXX] Add unused warning for variables declared in condition expressions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 30 10:10:00 PDT 2023
aaron.ballman added a comment.
In D152495#4628877 <https://reviews.llvm.org/D152495#4628877>, @hans wrote:
> In D152495#4628785 <https://reviews.llvm.org/D152495#4628785>, @cor3ntin wrote:
>
>> It is used, but only in an assert. Seems like the right fix!
>
> I suppose it is technically, but I'm not sure the fix reads like an improvement to me... I guess that's often the case with unused variables vs. asserts though.
>
> In D152495#4628870 <https://reviews.llvm.org/D152495#4628870>, @goncharov wrote:
>
>> due to this change we have a enourmous number of new warnings, on the other hand -Wunused-variable is a valuable warning. I am not sure what is the policy and best practices for warnings but maybe there is a possiblity to make a transition period for enabling this type of warning separetely and to allow updating existing code?
>
> The usual policy is to put new warnings behind new flags so users can disable them selectively. It gets trickier when it's existing warnings getting enhanced like this. Would it be possible to put this new functionality behind a flag?
That might not be a bad idea in this case -- perhaps `-Wunused-condition-variable` and group it under `-Wunused-variable`?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152495/new/
https://reviews.llvm.org/D152495
More information about the cfe-commits
mailing list