[libvirt] [PATCH] Avoid pthread_sigmask on Win32 platforms
Eric Blake
eblake at redhat.com
Fri Feb 11 20:42:41 UTC 2011
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 at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110211/19923d66/attachment-0001.sig>
More information about the libvir-list
mailing list