On a Thursday in 2026, Peter Krempa via Devel wrote:
From: Peter Krempa <pkrempa@redhat.com>
The instance of the 'disconnected' global variable in vsh.c is written-only, so can be removed. Caught by new clang:
clang -Itools/libvirt_shell.a.p -Itools -I../tools -Iinclude -I../include -Isrc -I../src -Isrc/util -I../src/util -I. -I.. -I/usr/include/libxml2 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/sysprof-6 -I/usr/include/gio-unix-2.0 -I/usr/include/libmount -I/usr/include/blkid -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu99 -O2 -g @/builds/libvirt/libvirt/build/c-warnings.txt -fPIC -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600 -D_FUNCTION_DEF -pthread -DWITH_GZFILEOP -MD -MQ tools/libvirt_shell.a.p/vsh.c.o -MF tools/libvirt_shell.a.p/vsh.c.o.d -o tools/libvirt_shell.a.p/vsh.c.o -c ../tools/vsh.c ../tools/vsh.c:242:12: error: variable 'disconnected' set but not used [-Werror,-Wunused-but-set-global] 242 | static int disconnected; /* we may have been disconnected */ | ^ 1 error generated.
This instance exists since the 'vsh' module was split (834c5720e44). 'virsh' contains it's own instance.
Signed-off-by: Peter Krempa <pkrempa@redhat.com> --- tools/vsh.c | 16 ---------------- 1 file changed, 16 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano