From: Laszlo Ersek <lersek@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] build: disable -Wmissing-braces on older compilers
Date: Fri, 20 Oct 2017 17:08:38 +0200 [thread overview]
Message-ID: <ec107687-d109-9eaa-780c-851f73971178@redhat.com> (raw)
In-Reply-To: <9695ca9b-6275-d7bf-1c3b-147aeab25473@redhat.com>
On 10/20/17 13:02, Paolo Bonzini wrote:
> On 20/10/2017 12:48, Peter Maydell wrote:
>> On 20 October 2017 at 11:12, Paolo Bonzini <pbonzini@redhat.com> wrote:
>>> GCC 4.9 and newer stopped warning for missing braces around the
>>> "universal" C zero initializer {0}. One such initializer sneaked
>>> into scsi/qemu-pr-helper.c and is breaking the build with such
>>> older GCC versions.
>>>
>>> Detect the lack of support for the idiom, and disable the warning
>>> in that case.
>>>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>
>> AFAIK "{}" will work and not be warned about anywhere (we
>> use it extensively already) so you don't need to fall back to
>> memset...
>
> Doh, of course that will work in scsi/qemu-pr-helper.c. In general you
> can use {0} but not {} to initialize a scalar, like
>
> IDontKnowIfItsAnArrayOrPointer x = {}; //might fail
> IDontKnowIfItsAnArrayOrPointer x = {0}; //always works
>
> I'm not sure if that matters.
My remark below might matter even less, but:
I'd find it regrettable if we suppressed a wrong gcc warning about a
valid C construct by replacing the construct with a GNU-ism that is
*not* standard C. :/
Laszlo
next prev parent reply other threads:[~2017-10-20 15:08 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 10:12 [Qemu-devel] [PATCH] build: disable -Wmissing-braces on older compilers Paolo Bonzini
2017-10-20 10:27 ` Laszlo Ersek
2017-10-20 10:37 ` Paolo Bonzini
2017-10-20 10:45 ` Laszlo Ersek
2017-10-20 10:48 ` Peter Maydell
2017-10-20 11:02 ` Paolo Bonzini
2017-10-20 15:08 ` Laszlo Ersek [this message]
2017-10-20 15:09 ` Paolo Bonzini
2017-10-20 15:32 ` Laszlo Ersek
2017-10-20 15:44 ` Paolo Bonzini
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=ec107687-d109-9eaa-780c-851f73971178@redhat.com \
--to=lersek@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--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).