From 5191f087de98461a0b7bfa4ec36e0d980f2f3206 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 29 Feb 2012 12:50:51 +0000 Subject: [PATCH] LRN: Enforce GCC bitfield layout for some structs on W32 --- src/include/gnunet_common.h | 9 +++++++++ src/include/gnunet_dnsparser_lib.h | 2 +- src/include/gnunet_tun_lib.h | 6 +++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h index a1ef4ee24..f26d6bc98 100644 --- a/src/include/gnunet_common.h +++ b/src/include/gnunet_common.h @@ -140,6 +140,15 @@ */ #define GNUNET_PACKED __attribute__((packed)) +/** + * gcc-ism to get gcc bitfield layout when compiling with -mms-bitfields + */ +#if MINGW +#define GNUNET_GCC_STRUCT_LAYOUT __attribute__((gcc_struct)) +#else +#define GNUNET_GCC_STRUCT_LAYOUT +#endif + /** * gcc-ism to document unused arguments */ diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h index 0c310ba00..28cc4c048 100644 --- a/src/include/gnunet_dnsparser_lib.h +++ b/src/include/gnunet_dnsparser_lib.h @@ -128,7 +128,7 @@ struct GNUNET_DNSPARSER_Flags */ unsigned int recursion_available : 1 GNUNET_PACKED; -}; +} GNUNET_GCC_STRUCT_LAYOUT; /** diff --git a/src/include/gnunet_tun_lib.h b/src/include/gnunet_tun_lib.h index dac11d6a8..3bb1ea359 100644 --- a/src/include/gnunet_tun_lib.h +++ b/src/include/gnunet_tun_lib.h @@ -119,7 +119,7 @@ struct GNUNET_TUN_IPv4Header * Destination of the packet. */ struct in_addr destination_address GNUNET_PACKED; -}; +} GNUNET_GCC_STRUCT_LAYOUT; /** @@ -163,7 +163,7 @@ struct GNUNET_TUN_IPv6Header * Destination of the packet. */ struct in6_addr destination_address GNUNET_PACKED; -}; +} GNUNET_GCC_STRUCT_LAYOUT; /** @@ -224,7 +224,7 @@ struct GNUNET_TUN_TcpHeader * Urgent pointer. */ uint16_t urgent_pointer GNUNET_PACKED; -}; +} GNUNET_GCC_STRUCT_LAYOUT; /** -- 2.25.1