[Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Jeff Cody
On 32-bit hosts, some compilers will warn on too large integer constants for constants that are 64-bit in length. Explicitly put a 'ULL' suffix on those defines. Reported-by: Alexander Graf ag...@suse.de Signed-off-by: Jeff Cody jc...@redhat.com --- block/vhdx.h | 6 +++--- 1 file changed, 3

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Stefan Hajnoczi
On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large integer constants for constants that are 64-bit in length. Explicitly put a 'ULL' suffix on those defines. Reported-by: Alexander Graf ag...@suse.de Signed-off-by: Jeff Cody

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Richard W.M. Jones
On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large integer constants for constants that are 64-bit in length. Explicitly put a 'ULL' suffix on those defines. -#define VHDX_FILE_SIGNATURE 0x656C696678646876 /* vhdxfile in ASCII */

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Peter Maydell
On 14 March 2014 15:36, Richard W.M. Jones rjo...@redhat.com wrote: On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large integer constants for constants that are 64-bit in length. Explicitly put a 'ULL' suffix on those defines.

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Richard W.M. Jones
On Fri, Mar 14, 2014 at 03:38:55PM +, Peter Maydell wrote: On 14 March 2014 15:36, Richard W.M. Jones rjo...@redhat.com wrote: On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large integer constants for constants that are

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 16:36, Richard W.M. Jones wrote: On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large integer constants for constants that are 64-bit in length. Explicitly put a 'ULL' suffix on those defines. -#define

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 16:57, Richard W.M. Jones wrote: On Fri, Mar 14, 2014 at 03:38:55PM +, Peter Maydell wrote: On 14 March 2014 15:36, Richard W.M. Jones rjo...@redhat.com wrote: On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote: On 32-bit hosts, some compilers will warn on too large

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Peter Maydell
On 14 March 2014 16:17, Laszlo Ersek ler...@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... -- PMM

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 17:26, Peter Maydell wrote: On 14 March 2014 16:17, Laszlo Ersek ler...@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

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 17:35, Laszlo Ersek wrote: On 03/14/14 17:26, Peter Maydell wrote: On 14 March 2014 16:17, Laszlo Ersek ler...@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.

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Richard W.M. Jones
On Fri, Mar 14, 2014 at 05:26:06PM +0100, Laszlo Ersek wrote: (b) UINT64_C() is for uint_least64_t (7.18.4.1 Macros for minimum-width integer constants). uint_least64_t is a required type (7.18.1.2 Minimum-width integer types). In practice I'd say it doesn't matter which one we use: - ULL

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Peter Maydell
On 14 March 2014 16:35, Laszlo Ersek ler...@redhat.com wrote: On 03/14/14 17:26, Peter Maydell wrote: On 14 March 2014 16:17, Laszlo Ersek ler...@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

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 17:51, Richard W.M. Jones wrote: On Fri, Mar 14, 2014 at 05:26:06PM +0100, Laszlo Ersek wrote: (b) UINT64_C() is for uint_least64_t (7.18.4.1 Macros for minimum-width integer constants). uint_least64_t is a required type (7.18.1.2 Minimum-width integer types). In practice I'd

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 18:08, Peter Maydell wrote: On 14 March 2014 16:35, Laszlo Ersek ler...@redhat.com wrote: On 03/14/14 17:26, Peter Maydell wrote: On 14 March 2014 16:17, Laszlo Ersek ler...@redhat.com wrote: Unsigned long long is a gnu-ism for C89. It's a standard part of C99. Last time I

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Richard W.M. Jones
On Fri, Mar 14, 2014 at 06:27:07PM +0100, Laszlo Ersek wrote: *Why* someone would want to use an integer constant with type uint_least64_t is a separate matter. One example follows -- assume all of the below: - suppose you write portable C99 source code, - hence you can't take uint64_t for

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 18:49, Richard W.M. Jones wrote: On Fri, Mar 14, 2014 at 06:27:07PM +0100, Laszlo Ersek wrote: *Why* someone would want to use an integer constant with type uint_least64_t is a separate matter. One example follows -- assume all of the below: - suppose you write portable C99 source

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Peter Maydell
On 14 March 2014 17:42, Laszlo Ersek ler...@redhat.com wrote: 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

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 19:22, Peter Maydell wrote: On 14 March 2014 17:42, Laszlo Ersek ler...@redhat.com wrote: 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

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants

2014-03-14 Thread Laszlo Ersek
On 03/14/14 19:49, Laszlo Ersek wrote: One good example is for 6.4.4.1 Integer constants: QUIET CHANGE IN C99 Unsuffixed integer constants may have different types in C99 than in C89. Such constants greater than LONG_MAX are of type unsigned long in C89,