qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X


From: Programmingkid
Subject: Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X
Date: Mon, 18 Jan 2016 16:09:56 -0500

On Jan 18, 2016, at 3:49 PM, Peter Maydell wrote:

> On 18 January 2016 at 19:50, Programmingkid <address@hidden> wrote:
>> I tried what Peter Maydell did and here are the results:
>> 
>> typedef __darwin_size_t size_t;
>> 
>> char control[(((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(struct 
>> cmsghdr)) + (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)) + 
>> ((__darwin_size_t)((char *)(__darwin_size_t)(sizeof(int) * 16) + 
>> (sizeof(__uint32_t) - 1)) &~ (sizeof(__uint32_t) - 1)))] = { 0 };
>> 
>> It looks like the problem was actually with this part: = { 0 };
> 
> No, the problem is that the compiler seems to think the bit in []
> is not compile time constant (the = { 0 } initializer syntax
> is valid if and only if it is compile-time-constant).
> 
> Can you say what 'gcc --version' prints for you? That will
> tell us the clang version number, which is more interesting
> than what clang claims its gcc-compatibility is.

$ gcc-4.9 --version
gcc-4.9 (Homebrew gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> I'm leaning towards this being a compiler bug fixed in
> a later version of clang, because that [] expression looks
> like it should be constant to me, and it's constant as
> far as my clang version thinks.

A bug could be the case. I use gcc 4.9.2 to compile QEMU.
I don't use the clang compiler. 

Just in case here is the info from Apple's clang compiler on
my system:

$ gcc --version
i686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) 
(LLVM build 2336.1.00)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]