[libvirt] [PATCH] util: clang is failing due to unused variables.
Julio Faracco
jcfaracco at gmail.com
Fri Jul 27 21:06:49 UTC 2018
Ow,
I was pretty sure that clang would complain about not handling the function
return properly. Well, I changed it and clang is not throwing any error. Weird!
Sending a V2.
Michael's patch was applied, so we need a new one to remove the other
occurrences.
Em sex, 27 de jul de 2018 às 17:59, John Ferlan <jferlan at redhat.com> escreveu:
>
>
>
> 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);
> > ^
> > 1 error generated.
> > Makefile:11579: recipe for target 'util/libvirt_util_la-virmdev.lo' failed
> > make[3]: *** [util/libvirt_util_la-virmdev.lo] Error 1
> > make[3]: *** Waiting for unfinished jobs....
> > util/virscsivhost.c:112:37: error: unused variable 'tmp' [-Werror,-Wunused-variable]
> > VIR_AUTOPTR(virSCSIVHostDevice) tmp = virSCSIVHostDeviceListSteal(list, dev);
> > ^
> > 1 error generated.
> > Makefile:11411: recipe for target 'util/libvirt_util_la-virscsivhost.lo' failed
> > make[3]: *** [util/libvirt_util_la-virscsivhost.lo] Error 1
> > util/virusb.c:511:31: error: unused variable 'ret' [-Werror,-Wunused-variable]
> > VIR_AUTOPTR(virUSBDevice) ret = virUSBDeviceListSteal(list, dev);
> >
> > Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
> > ---
> > src/util/virmdev.c | 3 ++-
> > src/util/virscsivhost.c | 3 ++-
> > src/util/virusb.c | 3 ++-
> > 3 files changed, 6 insertions(+), 3 deletions(-)
> >
>
> <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.
>
> John
>
> > diff --git a/src/util/virmdev.c b/src/util/virmdev.c
> > index 4050835cc1..63df4e40d8 100644
> > --- a/src/util/virmdev.c
> > +++ b/src/util/virmdev.c
> > @@ -370,7 +370,8 @@ void
> > virMediatedDeviceListDel(virMediatedDeviceListPtr list,
> > virMediatedDevicePtr dev)
> > {
> > - VIR_AUTOPTR(virMediatedDevice) ret = virMediatedDeviceListSteal(list, dev);
> > + VIR_AUTOPTR(virMediatedDevice) ret ATTRIBUTE_UNUSED
> > + = virMediatedDeviceListSteal(list, dev);
> > }
> >
> >
> > diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c
> > index 280d0dc2fd..e07cd46ba9 100644
> > --- a/src/util/virscsivhost.c
> > +++ b/src/util/virscsivhost.c
> > @@ -109,7 +109,8 @@ void
> > virSCSIVHostDeviceListDel(virSCSIVHostDeviceListPtr list,
> > virSCSIVHostDevicePtr dev)
> > {
> > - VIR_AUTOPTR(virSCSIVHostDevice) tmp = virSCSIVHostDeviceListSteal(list, dev);
> > + VIR_AUTOPTR(virSCSIVHostDevice) tmp ATTRIBUTE_UNUSED
> > + = virSCSIVHostDeviceListSteal(list, dev);
> > }
> >
> >
> > diff --git a/src/util/virusb.c b/src/util/virusb.c
> > index 609d54836f..73a1041097 100644
> > --- a/src/util/virusb.c
> > +++ b/src/util/virusb.c
> > @@ -508,7 +508,8 @@ void
> > virUSBDeviceListDel(virUSBDeviceListPtr list,
> > virUSBDevicePtr dev)
> > {
> > - VIR_AUTOPTR(virUSBDevice) ret = virUSBDeviceListSteal(list, dev);
> > + VIR_AUTOPTR(virUSBDevice) ret ATTRIBUTE_UNUSED
> > + = virUSBDeviceListSteal(list, dev);
> > }
> >
> > virUSBDevicePtr
> >
More information about the libvir-list
mailing list