From: Eric Blake <eblake@redhat.com>
To: Stefan Weil <sw@weilnetz.de>
Cc: Blue Swirl <blauwirbel@gmail.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] w32: Always use standard instead of native format strings
Date: Mon, 24 Sep 2012 13:28:47 -0600 [thread overview]
Message-ID: <5060B46F.8060400@redhat.com> (raw)
In-Reply-To: <1345664552-2250-1-git-send-email-sw@weilnetz.de>
[-- Attachment #1: Type: text/plain, Size: 1785 bytes --]
On 08/22/2012 01:42 PM, Stefan Weil wrote:
> GLib 2.0 include files use __printf__ for the format attribute
> which resolves to native format strings on w32 hosts.
>
> QEMU wants standard format strings instead of native format
> strings, so we simply change any declaration with __printf__
> to use __gnu_printf__.
>
> This works because all basic printf functions support both
> kinds of format strings.
>
> This fixes a compiler warning:
>
> qapi/string-output-visitor.c: In function ‘print_type_int’:
> qapi/string-output-visitor.c:34:5: warning: unknown conversion type character ‘l’ in format [-Wformat]
> qapi/string-output-visitor.c:34:5: warning: too many arguments for format [-Wformat-extra-args]
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> ---
> compiler.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/compiler.h b/compiler.h
> index 07ba1f8..c734a71 100644
> --- a/compiler.h
> +++ b/compiler.h
> @@ -44,6 +44,11 @@
> /* Use gnu_printf when supported (qemu uses standard format strings). */
> # define GCC_ATTR __attribute__((__unused__, format(gnu_printf, 1, 2)))
> # define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m)))
> +# if defined(_WIN32)
> + /* Map __printf__ to __gnu_printf__ because we want standard format strings
> + * even when MinGW or GLib include files use __printf__. */
> +# define __printf__ __gnu_printf__
> +# endif
Don't you need to make this conditional on the gcc version? That is,
gcc 4.4 added __gnu_printf__, but gcc 4.3 understands only __printf__
and attempts to pass __gnu_printf__ will cause compilation failure.
--
Eric Blake eblake@redhat.com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 617 bytes --]
next prev parent reply other threads:[~2012-09-24 19:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-22 19:42 [Qemu-devel] [PATCH] w32: Always use standard instead of native format strings Stefan Weil
2012-09-23 6:39 ` Stefan Hajnoczi
2012-09-24 19:28 ` Eric Blake [this message]
2012-09-24 19:45 ` Stefan Weil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5060B46F.8060400@redhat.com \
--to=eblake@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=sw@weilnetz.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).