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

Re: [libvirt] [PATCH] Avoid pthread_sigmask on Win32 platforms

On 02/10/2011 07:38 AM, Matthias Bolte wrote:
> I get errors like this related to %lld in format strings:
> virsh.c: In function 'cmdDomblkstat':
> virsh.c:990:9: warning: unknown conversion type character 'l' in
> format [-Wformat]
> The problem goes away when I replace the define for vshPrint
> #define vshPrint(ctl, ...) fprintf(stdout, __VA_ARGS__)
> by this function
> static void
> vshPrint(vshControl *ctl ATTRIBUTE_UNUSED, const char *format, ...)
> {
>     va_list ap;
>     va_start(ap, format);
>     vfprintf(stdout, format, ap);
>     va_end(ap);
> }

Well yeah, writing a wrapper functions makes the warnings go away if the
wrapper doesn't have the write __attribute__ attached to it; but it
doesn't fix the real problem, which is that we aren't using the
fprintf-posix gnulib module, and therefore, we will still cause issues
on mingw trying to format with %lld.

A better alternative is to instead use [v]asprintf (where we ARE using
the gnulib module, and %lld works), and print that resulting string.

I'll propose a patch.

> I'm not sure why this became a problem now, as vshPrint is a define
> since 2006 and virsh used to compile before. Maybe this is an issue
> with gnulib in the current libvirt-0.8.8-rc1 tarball, as I'm testing
> based on this tarball it.

I'm not sure either, unless you have recently upgraded mingw headers and
the headers recently added a gcc attribute to fprintf where it used to
not have one.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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