Re: [PATCH] util: Fix build on s390

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

 



On 10/07/2016 12:43 PM, Jiri Denemark wrote:
> GCC on s390 complains
> 
> util/virconf.c: In function 'virConfGetValueSizeT':
> util/virconf.c:1220:9: error: format '%zu' expects argument of type
> 'size_t', but argument 9 has type 'unsigned int' [-Werror=format=]
> 
> Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx>
> ---
>  src/util/virconf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/util/virconf.c b/src/util/virconf.c
> index 3e49f41..1372389 100644
> --- a/src/util/virconf.c
> +++ b/src/util/virconf.c
> @@ -1219,7 +1219,7 @@ int virConfGetValueSizeT(virConfPtr conf,
>      if (((unsigned long long)cval->l) > SIZE_MAX) {
>          virReportError(VIR_ERR_INTERNAL_ERROR,
>                         _("%s: value for '%s' parameter must be in range 0:%zu"),
> -                       conf->filename, setting, SIZE_MAX);
> +                       conf->filename, setting, (size_t) SIZE_MAX);
>          return -1;
>      }
>  #endif

S/390 32 bit uses an "unsigned long" as size_t while every other 32 bit target uses "unsigned int".
The __SIZE_MAX__ predefined macro generated by GCC itself handles this correctly by defining it as
4294967295UL. However, the stdint.h header defines it as 4294967295U. So in the end we probably have
to fix the Glibc header. This workaround is ok I think. Directly using __SIZE_MAX__ instead of
SIZE_MAX would not be portable.

-Andreas-


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