From: Laszlo Ersek <lersek@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Kevin Wolf <kwolf@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Jeff Cody <jcody@redhat.com>, Alexander Graf <agraf@suse.de>,
"Richard W.M. Jones" <rjones@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants
Date: Fri, 14 Mar 2014 18:42:04 +0100 [thread overview]
Message-ID: <53233F6C.4030502@redhat.com> (raw)
In-Reply-To: <CAFEAcA9-C6Ya35Ap=5KqszWTAviXdALgpKZY0vHv6ixRCBdBoQ@mail.gmail.com>
On 03/14/14 18:08, Peter Maydell wrote:
> On 14 March 2014 16:35, Laszlo Ersek <lersek@redhat.com> wrote:
>> On 03/14/14 17:26, Peter Maydell wrote:
>>> On 14 March 2014 16:17, Laszlo Ersek <lersek@redhat.com> wrote:
>>>> "Unsigned long long" is a gnu-ism for C89. It's a standard part of C99.
>>>> Last time I checked, qemu used the gnu89 dialect on all build hosts
>>>> except SunOS.
>>>
>>> HACKING says we use C99...
>>
>> HACKING lies then :)
>>
>> grep for "std=c99" or "std=gnu99". You will find no hits for the former,
>> and one hit for the latter, when the build host is SunOS. (Or just grep
>> for '-std='.)
>>
>> In gcc-4.8.2, -std still defaults to gnu89.
>
> HACKING says what we intend. If we need to pass an argument
> to gcc to get it to accept C99 constructs we should fix
> configure.
I agree 100%.
However, it wouldn't be an immediate, transparent change. For example,
out-of-range left-shifting for a signed int is explicitly undefined
behavior in C99 (6.5.7p4) -- equally for shifting left a negative value
-- and the argument has been made before that C89 does *not* say this.
(Actually I think that it's undefined just the same in C89 -- undefined
by omission. See 3.16, "... by the omission of any explicit definition
of behavior...")
IOW I welcome your proposal, but such a step will make patches like your own
[Qemu-devel] [PATCH 00/12] Avoid shifting left into sign bit
very necessary, not just a convenience to sanitize warnings that only
clang emits today.
In any case, I'd propose gnu99 rather than c99, because c99 might not be
a superset of gnu89. In some aspects it would be a step forward, but in
others it could be a step back. Gnu99 only goes forward. (Gnu99 is
promised as the next gcc default.)
Personal note: if qemu moves to c99 or gnu99, as per -std=, I want a
personal license to use constants like 0u and 1u in the code wherever I
want; no style complaints. Deal? :)
Thanks
Laszlo
next prev parent reply other threads:[~2014-03-14 17:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 10:50 [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants Jeff Cody
2014-03-14 15:25 ` Stefan Hajnoczi
2014-03-14 15:36 ` Richard W.M. Jones
2014-03-14 15:38 ` Peter Maydell
2014-03-14 15:57 ` Richard W.M. Jones
2014-03-14 16:26 ` Laszlo Ersek
2014-03-14 16:51 ` Richard W.M. Jones
2014-03-14 17:27 ` Laszlo Ersek
2014-03-14 17:49 ` Richard W.M. Jones
2014-03-14 18:16 ` Laszlo Ersek
2014-03-14 16:17 ` Laszlo Ersek
2014-03-14 16:26 ` Peter Maydell
2014-03-14 16:35 ` Laszlo Ersek
2014-03-14 16:36 ` Laszlo Ersek
2014-03-14 17:08 ` Peter Maydell
2014-03-14 17:42 ` Laszlo Ersek [this message]
2014-03-14 18:22 ` Peter Maydell
2014-03-14 18:49 ` Laszlo Ersek
2014-03-14 18:57 ` Laszlo Ersek
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=53233F6C.4030502@redhat.com \
--to=lersek@redhat.com \
--cc=agraf@suse.de \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=rjones@redhat.com \
--cc=stefanha@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 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).