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

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