qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/7] Add new macro QEMU_PACKED for packed C stru


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH 1/7] Add new macro QEMU_PACKED for packed C structures
Date: Tue, 30 Aug 2011 22:17:21 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110818 Iceowl/1.0b1 Icedove/3.0.11

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: 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: ‘gcc_struct’ attribute directive ignored

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


reply via email to

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