From: Peter Maydell <peter.maydell@linaro.org>
To: Eric Blake <eblake@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__
Date: Tue, 31 Jan 2017 16:54:50 +0000 [thread overview]
Message-ID: <CAFEAcA-PLbA80Hftk+M1DbfCv4vpnSsyiGCynspO9eiyBbsLiw@mail.gmail.com> (raw)
In-Reply-To: <7df08f03-9244-a246-ff89-fc0ffb69c736@redhat.com>
On 31 January 2017 at 16:37, Eric Blake <eblake@redhat.com> wrote:
> On 01/31/2017 10:07 AM, Markus Armbruster wrote:
>>> I tried that first thing.
>>> This generates lots of warnings if you have multiple users
>>> within a function: gcc is unhappy about the redundant extern
>>> declarations.
>>
>> #define QEMU_BUILD_BUG_ON(x) \
>> _Pragma("GCC diagnostic push") \
>> _Pragma("GCC diagnostic ignored \"-Wredundant-decls\"") \
>> extern char qemu_build_bug_on_[QEMU_BUILD_BUG_ON_ZERO((x))] __attribute__((unused)); \
>> _Pragma("GCC diagnostic pop")
>
> Do we know if pragma GCC diagnostic push is supported in our minimum
> compiler requirements (gcc 4.1, and presumably clang just ignores the
> pragma)?
Nope; that's gcc 4.6 or newer. They're also a bit flaky between
gcc and clang because they rely on the warning being the same
in both cases. Using them in QEMU_BUILD_BUG_ON would be
massively overkill, especially since gcc 4.6 and on support
_Static_assert() which will get us better error messages
than this stuff.
thanks
-- PMM
next prev parent reply other threads:[~2017-01-31 16:55 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 14:43 [Qemu-devel] [PATCH] QEMU_BUILD_BUG_ON: use __COUNTER__ Michael S. Tsirkin
2017-01-31 15:02 ` Peter Maydell
2017-01-31 15:03 ` Eric Blake
2017-01-31 15:12 ` Peter Maydell
2017-01-31 15:16 ` Eric Blake
2017-01-31 15:26 ` Peter Maydell
2017-01-31 15:28 ` Paolo Bonzini
2017-01-31 16:17 ` Peter Maydell
2017-01-31 15:34 ` Markus Armbruster
2017-01-31 17:58 ` Michael S. Tsirkin
2017-01-31 15:26 ` Markus Armbruster
2017-01-31 15:29 ` Michael S. Tsirkin
2017-01-31 16:07 ` Markus Armbruster
2017-01-31 16:37 ` Eric Blake
2017-01-31 16:54 ` Peter Maydell [this message]
2017-01-31 15:47 ` Peter Maydell
2017-01-31 16:50 ` Daniel P. Berrange
2017-01-31 17:56 ` Michael S. Tsirkin
2017-01-31 18:43 ` Markus Armbruster
2017-01-31 18:58 ` Eric Blake
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=CAFEAcA-PLbA80Hftk+M1DbfCv4vpnSsyiGCynspO9eiyBbsLiw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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).