From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOW7u-000640-IV for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:42:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOW7o-0006GG-II for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:42:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40216) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOW7o-0006G7-A6 for qemu-devel@nongnu.org; Fri, 14 Mar 2014 13:42:28 -0400 Message-ID: <53233F6C.4030502@redhat.com> Date: Fri, 14 Mar 2014 18:42:04 +0100 From: Laszlo Ersek MIME-Version: 1.0 References: <3096076082478dafe78553ab5cbd8b572904cbc4.1394794127.git.jcody@redhat.com> <20140314153639.GD1985@redhat.com> <53232B90.5060408@redhat.com> <53232FD4.1020605@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , QEMU Developers , Jeff Cody , Alexander Graf , "Richard W.M. Jones" , Stefan Hajnoczi On 03/14/14 18:08, Peter Maydell wrote: > On 14 March 2014 16:35, Laszlo Ersek wrote: >> On 03/14/14 17:26, Peter Maydell wrote: >>> On 14 March 2014 16:17, Laszlo Ersek 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