From da2965ea12e0e92e207919efc9f63bce3fa7b31c Mon Sep 17 00:00:00 2001 From: "KJK::Hyperion" Date: Sun, 21 Jun 2009 21:40:37 +0000 Subject: [PATCH] Compilers other than GCC deserve offsetof, don't they? svn path=/trunk/; revision=41519 --- reactos/include/crt/stddef.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/include/crt/stddef.h b/reactos/include/crt/stddef.h index 02b6d7a9e53..8aa692e540a 100644 --- a/reactos/include/crt/stddef.h +++ b/reactos/include/crt/stddef.h @@ -287,7 +287,7 @@ typedef long ssize_t; symbols in the _FOO_T_ family, stays defined even after its corresponding type is defined). If we define wchar_t, then we must undef _WCHAR_T_; for BSD/386 1.1 (and perhaps others), if - we undef _WCHAR_T_, then we must also define rune_t, since + we undef _WCHAR_T_, then we must also define rune_t, since headers like runetype.h assume that if machine/ansi.h is included, and _BSD_WCHAR_T_ is not defined, then rune_t is available. machine/ansi.h says, "Note that _WCHAR_T_ and _RUNE_T_ must be of @@ -390,7 +390,11 @@ typedef __WCHAR_TYPE__ wchar_t; #ifndef offsetof /* Offset of member MEMBER in a struct of type TYPE. */ +#if defined(__GNUC__) #define offsetof(TYPE, MEMBER) __builtin_offsetof (TYPE, MEMBER) +#else +#define offsetof(TYPE, MEMBER) ((size_t)&(((TYPE *)0)->MEMBER)) +#endif #endif /* !offsetof */