[libvirt] [PATCH] util: clang is failing due to unused variables.
Eric Blake
eblake at redhat.com
Fri Jul 27 21:06:56 UTC 2018
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
More information about the libvir-list
mailing list