All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Liviu Ionescu <ilg@livius.net>,
	QEMU Developers <Qemu-devel@nongnu.org>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] MinGW build
Date: Fri, 27 Nov 2015 20:16:49 +0100	[thread overview]
Message-ID: <5658AC21.2000805@weilnetz.de> (raw)
In-Reply-To: <CAFEAcA_6JaDhdbiqPXrJFsy8BLWVxraJR9tLJp2y4gVVpb-QfQ@mail.gmail.com>

Am 27.11.2015 um 19:49 schrieb Peter Maydell:
> On 28 November 2014 at 07:14, Stefan Weil <sw@weilnetz.de> wrote:
>> The libvixl code is correct, but the C++ compiler would need to be
>> fixed. Here are some examples:
>>
>> disas/libvixl/a64/disasm-a64.cc:1340:57: warning: unknown conversion
>> type character ‘l’ in format [-Wformat]
>> disas/libvixl/a64/disasm-a64.cc:1340:57: warning: too many arguments for
>> format [-Wformat-extra-args]
>> disas/libvixl/a64/disasm-a64.cc:1492:42: warning: unknown conversion
>> type character ‘l’ in format [-Wformat]
>>
>> That code uses PRIx64, so the format specifier is %llx which is correct.
>> Obviously the C++ compiler ignores that QEMU uses ANSI format specifiers
>> (compiler option -D__USE_MINGW_ANSI_STDIO=1) instead of the MS specific
>> ones.
> 
> I finally got around to looking at this (a year later!), and it turns out
> that the problem here is just that libvixl's code for marking functions
> as having format strings doesn't have the check that we do in
> include/qemu/compiler.h:
> 
> #if defined __GNUC__
> # if !QEMU_GNUC_PREREQ(4, 4)
>    /* gcc versions before 4.4.x don't support gnu_printf, so use printf. */
> #  define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m)))
> # else
>    /* Use gnu_printf when supported (qemu uses standard format strings). */
> #  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
> # endif
> #else
> #define GCC_FMT_ATTR(n, m)
> #endif
> 
> ...which will effectively cause us to use 'gnu_printf' on this
> compiler, which works. The libvixl headers always use plain 'printf',
> which gets warnings. So I think we can fix this pretty simply in
> disas/libvixl/utils.h by making it also do "use gnu_printf for
> a compiler that's 4.4 or better".
> 
> thanks
> -- PMM
> 

Yes, that's correct. I just did a short test and replaced "printf"
by "gnu_printf" in disas/libvixl/utils.h: no more warnings when MinGW
compiles disas/libvixl/a64/disasm-a64.cc.

I think we can wait for a new version of libvixl which includes the fix,
no need for a last minute fix for QEMU 2.5. Will you report it to the
libvixl developers?

Thanks,
Stefan

  reply	other threads:[~2015-11-27 19:16 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-26 19:55 [Qemu-devel] MinGW build Liviu Ionescu
2014-11-26 20:13 ` Peter Maydell
2014-11-26 20:19   ` Stefan Weil
2014-11-26 21:44   ` Liviu Ionescu
2014-11-27 16:43   ` Liviu Ionescu
2014-11-27 19:34     ` Peter Maydell
2014-11-27 19:57       ` Liviu Ionescu
2014-11-27 20:09         ` Stefan Weil
2014-11-27 20:14           ` Liviu Ionescu
2014-11-27 20:18           ` Peter Maydell
2014-11-27 20:27             ` Liviu Ionescu
2014-11-27 22:04               ` Peter Maydell
2014-11-28  0:30                 ` Liviu Ionescu
2014-11-28  7:14             ` Stefan Weil
2014-11-28  8:41               ` Peter Maydell
2015-11-27 18:49               ` Peter Maydell
2015-11-27 19:16                 ` Stefan Weil [this message]
2015-11-27 21:05                   ` Peter Maydell
2015-11-29 12:03                     ` Juan Quintela
2015-12-03 11:58                       ` Peter Maydell
2015-12-03 14:15                         ` Peter Maydell
2015-12-03 14:30                           ` Juan Quintela
2015-11-30 13:24                 ` Juan Quintela
2015-11-30 13:29                   ` Stefan Weil
2014-11-27 20:52           ` Liviu Ionescu
2014-11-27 21:14             ` Stefan Weil
2014-11-27 21:38               ` Liviu Ionescu
2014-11-28  6:20                 ` Stefan Weil
2014-11-28  6:23                   ` Liviu Ionescu
2014-11-28  7:03                     ` Stefan Weil
2014-12-01 10:30                       ` Liviu Ionescu
2014-12-01 18:42                         ` Stefan Weil
2014-12-02 18:28                           ` Liviu Ionescu

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=5658AC21.2000805@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=Qemu-devel@nongnu.org \
    --cc=ilg@livius.net \
    --cc=peter.maydell@linaro.org \
    --cc=quintela@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.