From 2859b647026af1a927d1a74100f125bbc0f77db3 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Sat, 22 Jul 2006 17:28:48 +0000 Subject: Fix struct packing issues (macros are not resolve in #pragma params, at least for GCC) svn-id: r23569 --- common/pack-end.h | 24 ++++++++++++++++++++++++ common/pack-start.h | 24 ++++++++++++++++++++++++ common/scummsys.h | 10 +++++----- 3 files changed, 53 insertions(+), 5 deletions(-) create mode 100644 common/pack-end.h create mode 100644 common/pack-start.h (limited to 'common') diff --git a/common/pack-end.h b/common/pack-end.h new file mode 100644 index 0000000000..28461e16a7 --- /dev/null +++ b/common/pack-end.h @@ -0,0 +1,24 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2006 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#if defined(SCUMMVM_USE_PRAGMA_PACK) + #pragma pack() +#endif diff --git a/common/pack-start.h b/common/pack-start.h new file mode 100644 index 0000000000..b39238d03b --- /dev/null +++ b/common/pack-start.h @@ -0,0 +1,24 @@ +/* ScummVM - Scumm Interpreter + * Copyright (C) 2002-2006 The ScummVM project + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + */ + +#if defined(SCUMMVM_USE_PRAGMA_PACK) + #pragma pack(1) +#endif diff --git a/common/scummsys.h b/common/scummsys.h index cb26901ddf..c1bfc50528 100644 --- a/common/scummsys.h +++ b/common/scummsys.h @@ -73,15 +73,15 @@ // // By default we try to use pragma push/pop to ensure various structs we use // are "packed". If your compiler doesn't support this pragma, you are in for -// a problem. If you are lucky, an equivalent pragma is available, in which -// case you can redefine these two macros appropriately. Or maybe your port -// simply *always* packs everything, in which case you could #undefine them. +// a problem. If you are lucky, there is a compiler switch, or another pragma, +// doing the same thing -- in that case, try to modify common/pack-begin.h and +// common/pack-end.h accordingly. Or maybe your port simply *always* packs +// everything, in which case you could #undefine SCUMMVM_USE_PRAGMA_PACK. // // If neither is possible, tough luck. Try to contact the team, maybe we can // come up with a solution, though I wouldn't hold my breath on it :-/. // -#define START_PACK_STRUCTS pack(push, 1) -#define END_PACK_STRUCTS pack(pop) +#define SCUMMVM_USE_PRAGMA_PACK #if defined(_MSC_VER) && !defined(__SYMBIAN32__) && !defined(_WIN32_WCE) -- cgit v1.2.3