From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:50482) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyUkT-0003rK-R8 for qemu-devel@nongnu.org; Tue, 30 Aug 2011 16:17:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QyUkS-0002KD-Q8 for qemu-devel@nongnu.org; Tue, 30 Aug 2011 16:17:29 -0400 Received: from v220110690675601.yourvserver.net ([78.47.199.172]:35867) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QyUkS-0002K6-Di for qemu-devel@nongnu.org; Tue, 30 Aug 2011 16:17:28 -0400 Message-ID: <4E5D4551.8070906@mail.berlios.de> Date: Tue, 30 Aug 2011 22:17:21 +0200 From: Stefan Weil MIME-Version: 1.0 References: <1314564200-6872-1-git-send-email-weil@mail.berlios.de> <1314564200-6872-2-git-send-email-weil@mail.berlios.de> <4E5D2BFC.2090401@redhat.com> In-Reply-To: <4E5D2BFC.2090401@redhat.com> Content-Type: multipart/alternative; boundary="------------050601000803080309060405" Subject: Re: [Qemu-devel] [PATCH 1/7] Add new macro QEMU_PACKED for packed C structures List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Blue Swirl , QEMU Developers This is a multi-part message in MIME format. --------------050601000803080309060405 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Am 30.08.2011 20:29, schrieb Paolo Bonzini: > On 08/30/2011 07:57 PM, Blue Swirl wrote: >>> > >>> > +#if defined(_WIN32) >>> > +# define QEMU_PACKED __attribute__((gcc_struct, packed)) >> Maybe we could also use gcc_struct also for non-win32? >> >>> > +#else >>> > +# define QEMU_PACKED __attribute__((packed)) >>> > +#endif > > Indeed. > > Paolo > No. Extract from gcc documentation: "Two attributes are currently defined for i386 configurations:=20 |ms_struct| and |gcc_struct" For non i386 configuration, these configurations are undefined: mipsel-linux-gnu-gcc -c -Wall test.c test.c:3: warning: =E2=80=98gcc_struct=E2=80=99 attribute directive ignor= ed Therefore, we cannot use gcc_struct for most supported hosts. Linux i386 or x86_64 would support it, but they don't need it... We need one #if ... #else ... #endif to avoid 250 of them :-) Stefan | --------------050601000803080309060405 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 30.08.2011 20:29, schrieb Paolo Bonzini:
On 08/30/2011 07:57 PM, Blue Swirl wrote:
>
>=C2=A0 +#if defined(_WIN32)
>=C2=A0 +# define QEMU_PACKED __attribute__((gcc_struct, packed))
Maybe we could also use gcc_struct also for non-win32?

>=C2=A0 +#else
>=C2=A0 +# define QEMU_PACKED __attribute__((packed))
>=C2=A0 +#endif

Indeed.

Paolo


No. Extract from gcc documentation:

"Two attributes are currently defined for i386 configurations: ms_struct and gcc_struct"

For non i386 configuration, these configurations are undefined:

mipsel-linux-gnu-gcc -c -Wall test.c
test.c:3: warning: =E2=80=98gcc_struct=E2=80=99 attribute directive ignor= ed

Therefore, we cannot use gcc_struct for most supported hosts.
Linux i386 or x86_64 would support it, but they don't need it...

We need one #if ... #else ... #endif to avoid 250 of them :-)

Stefan

--------------050601000803080309060405--