[libvirt] [PATCH v3 6/9] tests: Fix mode_t usage with va_arg()

Daniel P. Berrangé berrange at redhat.com
Thu May 3 15:31:04 UTC 2018


On Thu, May 03, 2018 at 12:54:20PM +0200, Andrea Bolognani wrote:
> Clang complains about it:
> 
>   error: second argument to 'va_arg' is of promotable type
>   'mode_t' (aka 'unsigned short'); this va_arg has undefined
>   behavior because arguments will be promoted to 'int'
>   [-Werror,-Wvarargs]
> 
>     mode = va_arg(ap, mode_t);
>                       ^~~~~~
> 
> Work around the issue by passing int to va_arg() and casting
> its return value to mode_t afterwards.
> 
> Signed-off-by: Andrea Bolognani <abologna at redhat.com>
> ---
>  tests/nssmock.c       | 2 +-
>  tests/vircgroupmock.c | 2 +-
>  tests/virpcimock.c    | 2 +-
>  tests/virtestmock.c   | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list