[libvirt PATCH 0/4] Reinstate -Wunused-but-set-variable

Ján Tomko posted 4 patches 2 years, 6 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cover.1630783290.git.jtomko@redhat.com
build-aux/syntax-check.mk |  2 +-
meson.build               | 21 ---------------------
src/qemu/qemu_driver.c    |  9 ---------
src/rpc/virnetclient.c    |  6 +++---
src/util/viridentity.c    |  4 +++-
5 files changed, 7 insertions(+), 35 deletions(-)
[libvirt PATCH 0/4] Reinstate -Wunused-but-set-variable
Posted by Ján Tomko 2 years, 6 months ago
Personally, I feel like all the cases caught by new Clang's -Wunused-but-set-variable
behavior were also unnecessarily difficult to read for humans, we should be more obvious
when relying purely on side effects of g_auto and the warning is worth
keeping.

Even if not, the first two patches should not be controversial.

Ján Tomko (4):
  qemu: remove unused 'cfg' variables
  util: virIdentitySetCurrent: only unref the old identity on success
  rpc: mark source returned by virEventGLibAddSocketWatch as unused
  Revert "meson: avoid bogus warnings from clang and g_autoptr"

 build-aux/syntax-check.mk |  2 +-
 meson.build               | 21 ---------------------
 src/qemu/qemu_driver.c    |  9 ---------
 src/rpc/virnetclient.c    |  6 +++---
 src/util/viridentity.c    |  4 +++-
 5 files changed, 7 insertions(+), 35 deletions(-)

-- 
2.31.1

Re: [libvirt PATCH 0/4] Reinstate -Wunused-but-set-variable
Posted by Michal Prívozník 2 years, 6 months ago
On 9/4/21 9:25 PM, Ján Tomko wrote:
> Personally, I feel like all the cases caught by new Clang's -Wunused-but-set-variable
> behavior were also unnecessarily difficult to read for humans, we should be more obvious
> when relying purely on side effects of g_auto and the warning is worth
> keeping.
> 
> Even if not, the first two patches should not be controversial.
> 
> Ján Tomko (4):
>   qemu: remove unused 'cfg' variables
>   util: virIdentitySetCurrent: only unref the old identity on success
>   rpc: mark source returned by virEventGLibAddSocketWatch as unused
>   Revert "meson: avoid bogus warnings from clang and g_autoptr"
> 
>  build-aux/syntax-check.mk |  2 +-
>  meson.build               | 21 ---------------------
>  src/qemu/qemu_driver.c    |  9 ---------
>  src/rpc/virnetclient.c    |  6 +++---
>  src/util/viridentity.c    |  4 +++-
>  5 files changed, 7 insertions(+), 35 deletions(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal