Re: [PATCH] util: clang is failing due to unused variables.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/27/2018 03:58 PM, John Ferlan wrote:


On 07/27/2018 04:50 PM, Julio Faracco wrote:
After some recent patches, clang is throwing some errors related to
unused variables. This is not happening when we use GCC with -Werror
enabled. Only clang reports this warning.

make[3]: Entering directory '/home/julio/Desktop/virt/libvirt/src'
   CC       util/libvirt_util_la-virscsivhost.lo
   CC       util/libvirt_util_la-virusb.lo
   CC       util/libvirt_util_la-virmdev.lo
util/virmdev.c:373:36: error: unused variable 'ret' [-Werror,-Wunused-variable]
     VIR_AUTOPTR(virMediatedDevice) ret = virMediatedDeviceListSteal(list, dev);
                                    ^

clang is buggy. The variable 'ret' is very much in use, as the VIR_AUTOPTR() macro cannot work unless you attach it to a local variable to operate on when that variable goes out of scope.

You should file a bug report against clang.

But in the meantime,

<sigh>, see:

https://www.redhat.com/archives/libvir-list/2018-July/msg01917.html

Seems like it's the same thing and we should be consistent in the manner
in which we resolve.

Yes, that approach is much nicer - it is also less typing and less magic.

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux