Received: from eggs.gnu.org ([2001:4830:134:3::10]:58147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLH3t-00074Q-Ip for qemu-devel@nongnu.org; Mon, 18 Jan 2016 16:10:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLH3o-00057z-Ik for qemu-devel@nongnu.org; Mon, 18 Jan 2016 16:10:05 -0500 Received: from mail-io0-x230.google.com ([2607:f8b0:4001:c06::230]:33040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLH3o-00057n-E7 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 16:10:00 -0500 Received: by mail-io0-x230.google.com with SMTP id q21so561381486iod.0 for ; Mon, 18 Jan 2016 13:10:00 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: Date: Mon, 18 Jan 2016 16:09:56 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <279CE146-AEEB-49A9-BB39-C5A0C900784C@gmail.com> References: <5525054B-A7E2-4538-9F68-9E606B85B1B7@gmail.com> <569C224B.2040102@redhat.com> <1866CB23-7966-4F68-8925-2C3888753883@gmail.com> <569D24D2.3000800@redhat.com> <82CB3A8D-1061-48FF-9236-C09A54B5DC68@gmail.com> Subject: Re: [Qemu-devel] CMSG_SPACE() causing compile time error on Mac OS X List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Paolo Bonzini , qemu-devel qemu-devel On Jan 18, 2016, at 3:49 PM, Peter Maydell wrote: > On 18 January 2016 at 19:50, Programmingkid = wrote: >> I tried what Peter Maydell did and here are the results: >>=20 >> typedef __darwin_size_t size_t; >>=20 >> 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)))] =3D { 0 }; >>=20 >> It looks like the problem was actually with this part: =3D { 0 }; >=20 > No, the problem is that the compiler seems to think the bit in [] > is not compile time constant (the =3D { 0 } initializer syntax > is valid if and only if it is compile-time-constant). >=20 > 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.=20 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.