From: "Daniel P. Berrangé" <berrange@redhat.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Huth <thuth@redhat.com>,
Richard Henderson <richard.henderson@linaro.org>,
qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH 1/3] qemu/compiler: Simplify as all compilers support attribute 'gnu_printf'
Date: Mon, 28 Sep 2020 15:04:48 +0100 [thread overview]
Message-ID: <20200928140448.GH2230076@redhat.com> (raw)
In-Reply-To: <20200928125859.734287-2-philmd@redhat.com>
On Mon, Sep 28, 2020 at 02:58:57PM +0200, Philippe Mathieu-Daudé wrote:
> Since commit efc6c070aca ("configure: Add a test for the minimum
> compiler version") the minimum compiler version required for GCC
> is 4.8, which supports the gnu_printf attribute.
>
> We can safely remove the code introduced in commit 9c9e7d51bf0
> ("Move macros GCC_ATTR and GCC_FMT_ATTR to common header file").
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> include/qemu/compiler.h | 19 ++++++++-----------
> 1 file changed, 8 insertions(+), 11 deletions(-)
>
> diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
> index c76281f3540..207e3bd4feb 100644
> --- a/include/qemu/compiler.h
> +++ b/include/qemu/compiler.h
> @@ -104,17 +104,14 @@
> sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)))
>
> #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
> + /* 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
> #else
> #define GCC_FMT_ATTR(n, m)
I think this can be simplified even more by using GLib's macros
#define GCC_FMT_ATTR(n, m) G_GNUC_PRINTF(n, m)
and ideally we'd then convert all crrent usage to the latter and
drop GCC_FMT_ATTR.
https://developer.gnome.org/glib/2.64/glib-Miscellaneous-Macros.html
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2020-09-28 14:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-28 12:58 [PATCH 0/3] qemu/compiler: Remove unused special case code for GCC < 4.8 Philippe Mathieu-Daudé
2020-09-28 12:58 ` [PATCH 1/3] qemu/compiler: Simplify as all compilers support attribute 'gnu_printf' Philippe Mathieu-Daudé
2020-09-28 13:43 ` Peter Maydell
2020-09-28 14:04 ` Daniel P. Berrangé [this message]
2020-09-28 14:14 ` Peter Maydell
2020-09-28 14:23 ` Daniel P. Berrangé
2020-09-28 14:32 ` Peter Maydell
2020-09-28 14:39 ` Daniel P. Berrangé
2020-09-28 16:49 ` Paolo Bonzini
2020-09-28 12:58 ` [PATCH 2/3] qemu/atomic: Drop special case for unsupported compiler Philippe Mathieu-Daudé
2020-09-28 13:36 ` Peter Maydell
2020-11-25 15:07 ` Marc-André Lureau
2020-09-28 12:58 ` [PATCH 3/3] accel/tcg: Remove special case for GCC < 4.6 Philippe Mathieu-Daudé
2020-09-28 13:52 ` Peter Maydell
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=20200928140448.GH2230076@redhat.com \
--to=berrange@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=rth@twiddle.net \
--cc=thuth@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.