From 2fef98ba8a0d18ce669e4bdabba419ad7dd5ce3c Mon Sep 17 00:00:00 2001 From: Vincent Torri Date: Wed, 16 Sep 2009 22:02:59 +0000 Subject: [PATCH] use __attribute__((packed)) if __GNUC__ is defined use #pragma pack if vc++ is used use nothing otherwise (should we exit with an error in that case ?) SVN revision: 42533 --- legacy/embryo/src/lib/embryo_private.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/legacy/embryo/src/lib/embryo_private.h b/legacy/embryo/src/lib/embryo_private.h index 240772fc0c..18026b07f5 100644 --- a/legacy/embryo/src/lib/embryo_private.h +++ b/legacy/embryo/src/lib/embryo_private.h @@ -249,11 +249,20 @@ struct _Embryo_Program void *data; }; +#ifdef _MSC_VER +# pragma pack(1) +# define EMBRYO_STRUCT_PACKED +#elif defined (__GNUC__) +# define EMBRYO_STRUCT_PACKED __attribute__((packed)) +#else +# define EMBRYO_STRUCT_PACKED +#endif + struct _Embryo_Func_Stub { int address; char name[sEXPMAX+1]; -} __attribute__((packed)); +} EMBRYO_STRUCT_PACKED; struct _Embryo_Header { @@ -274,7 +283,11 @@ struct _Embryo_Header int pubvars; /* the "public variables" table */ int tags; /* the "public tagnames" table */ int nametable; /* name table, file version 7 only */ -} __attribute__((packed)); +} EMBRYO_STRUCT_PACKED; + +#ifdef _MSC_VER +# pragma pack() +#endif void _embryo_args_init(Embryo_Program *ep); void _embryo_fp_init(Embryo_Program *ep);