From 6d5303c868403f42f1e2220c28c352fa8647a497 Mon Sep 17 00:00:00 2001 From: gbeauche <> Date: Sun, 13 Feb 2005 18:18:59 +0000 Subject: [PATCH] Support FreeBSD 5.3: - fix implementation of offsetof() with GCC >= 3.4 and C++ code --- SheepShaver/src/Unix/sysdeps.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SheepShaver/src/Unix/sysdeps.h b/SheepShaver/src/Unix/sysdeps.h index 90f15243..0760c236 100644 --- a/SheepShaver/src/Unix/sysdeps.h +++ b/SheepShaver/src/Unix/sysdeps.h @@ -41,6 +41,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,17 @@ # endif #endif +// Fix offsetof() on FreeBSD and GCC >= 3.4 +#if defined(__FreeBSD__) && defined(__cplusplus) +#undef offsetof +/* The cast to "char &" below avoids problems with user-defined + "operator &", which can appear in a POD type. */ +#define offsetof(TYPE, MEMBER) \ + (__offsetof__ (reinterpret_cast \ + (&reinterpret_cast \ + (static_cast (0)->MEMBER)))) +#endif + // Define for external components #define SHEEPSHAVER 1