[Spice-devel] [PATCH] mingw32: specify packing alignment to 1 byte, to override -mms-bitfield
Alon Levy
alevy at redhat.com
Thu Dec 30 01:35:55 PST 2010
On Wed, Dec 29, 2010 at 04:14:49PM +0100, Marc-André Lureau wrote:
> From: Marc-André Lureau <marcandre.lureau at redhat.com>
>
> Ex: G_STRUCT_OFFSET(SpiceLinkReply, num_channel_caps) is 172 bytes
> when compiled with -mms-bitfield, and 170 bytes without.
>
> GLib/Gtk are compiled with -mms-bitfield, and it is necessary to
> compile with the same option for compatibility. The pack pragma
> for MINGW32 corrects the structure alignement.
>
> We could use the pack pragma for GNUC unconditionally, that could help
> to ensure struct binary compatibility between different compiled
> flavours.
ACK. I don't know about specifying it unconditionally, I think sometimes
a warning is issues for an unsupported pragma (which would turn to an error
with -Werror).
Since you don't have pushing permissions yet (really need to fix that) I'll
push this for you.
> ---
> spice/end-packed.h | 4 +---
> spice/start-packed.h | 4 ++++
> 2 files changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/spice/end-packed.h b/spice/end-packed.h
> index e191737..1acea18 100644
> --- a/spice/end-packed.h
> +++ b/spice/end-packed.h
> @@ -33,8 +33,6 @@
>
> #undef SPICE_ATTR_PACKED
>
> -#ifndef __GNUC__
> -
> +#if defined(__MINGW32__) || !defined(__GNUC__)
> #pragma pack(pop)
> -
> #endif
> diff --git a/spice/start-packed.h b/spice/start-packed.h
> index 78ec7c7..ab3fa98 100644
> --- a/spice/start-packed.h
> +++ b/spice/start-packed.h
> @@ -49,6 +49,10 @@
>
> #define SPICE_ATTR_PACKED __attribute__ ((__packed__))
>
> +#ifdef __MINGW32__
> +#pragma pack(push,1)
> +#endif
> +
> #else
>
> #pragma pack(push)
> --
> 1.7.3.4
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
More information about the Spice-devel
mailing list