gcc-3.3 does not have __offsetof__, but gcc-3.4 eems to require it:

From the redhat web page:

http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/gcc/offsetof.html

__offsetof__ (expression)
    is equivalent to the parenthesized expression, except that the
    expression is considered an integral constant expression even if
    it contains certain operators that are not normally permitted in
    an integral constant expression. Users should never use __offsetof__
    directly; the only valid use of __offsetof__ is to implement the
    offsetof macro in <stddef.h>.
This commit is contained in:
christos 2006-08-21 15:26:49 +00:00
parent a4f92031c6
commit a162f659c6

View File

@ -1,4 +1,4 @@
/* $NetBSD: stddef.h,v 1.12 2006/08/21 15:02:23 christos Exp $ */
/* $NetBSD: stddef.h,v 1.13 2006/08/21 15:26:49 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -55,8 +55,11 @@ typedef _BSD_WCHAR_T_ wchar_t;
#elif !defined(__cplusplus)
#define offsetof(type, member) ((size_t)(unsigned long)(&((type *)0)->member))
#else
#define offsetof(type, member) (reinterpret_cast<size_t> \
(&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member)))
#ifndef __offsetof__
#define __offsetof__(a) a
#endif
#define offsetof(type, member) __offsetof__((reinterpret_cast<size_t> \
(&reinterpret_cast<const volatile char &>(static_cast<type *>(0)->member))))
#endif
#endif /* _STDDEF_H_ */