Support FreeBSD 5.3:

- fix implementation of offsetof() with GCC >= 3.4 and C++ code
This commit is contained in:
gbeauche 2005-02-13 18:18:59 +00:00
parent 3aeed84471
commit 6d5303c868

View File

@ -41,6 +41,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
#include <signal.h>
@ -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 <size_t> \
(&reinterpret_cast <char &> \
(static_cast<TYPE *> (0)->MEMBER))))
#endif
// Define for external components
#define SHEEPSHAVER 1