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

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

 




On 07/27/2018 05:17 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@xxxxxxxxx>
> ---
>  src/util/virmdev.c      | 2 +-
>  src/util/virscsivhost.c | 2 +-
>  src/util/virusb.c       | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 

Close, but you forgot something on each.

> diff --git a/src/util/virmdev.c b/src/util/virmdev.c
> index 4050835cc1..4492fd673e 100644
> --- a/src/util/virmdev.c
> +++ b/src/util/virmdev.c
> @@ -370,7 +370,7 @@ void
>  virMediatedDeviceListDel(virMediatedDeviceListPtr list,
>                           virMediatedDevicePtr dev)
>  {
> -    VIR_AUTOPTR(virMediatedDevice) ret = virMediatedDeviceListSteal(list, dev);
> +    virMediatedDeviceListSteal(list, dev);

Wrap a "virMediatedDeviceFree()" around this

>  }
>  
>  
> diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c
> index 280d0dc2fd..1a069e67ff 100644
> --- a/src/util/virscsivhost.c
> +++ b/src/util/virscsivhost.c
> @@ -109,7 +109,7 @@ void
>  virSCSIVHostDeviceListDel(virSCSIVHostDeviceListPtr list,
>                            virSCSIVHostDevicePtr dev)
>  {
> -    VIR_AUTOPTR(virSCSIVHostDevice) tmp = virSCSIVHostDeviceListSteal(list, dev);
> +    virSCSIVHostDeviceListSteal(list, dev);

Wrap a "virSCSIVHostDeviceFree()" around this.

>  }
>  
>  
> diff --git a/src/util/virusb.c b/src/util/virusb.c
> index 609d54836f..d14b7623cc 100644
> --- a/src/util/virusb.c
> +++ b/src/util/virusb.c
> @@ -508,7 +508,7 @@ void
>  virUSBDeviceListDel(virUSBDeviceListPtr list,
>                      virUSBDevicePtr dev)
>  {
> -    VIR_AUTOPTR(virUSBDevice) ret = virUSBDeviceListSteal(list, dev);
> +    virUSBDeviceListSteal(list, dev);

Wrap a "virUSBDeviceFree()" around this.

I fixed those and pushed.


Tks,

John
>  }
>  
>  virUSBDevicePtr
> 

--
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