diff options
| author | christos <christos@NetBSD.org> | 2006-08-21 15:26:49 +0000 |
|---|---|---|
| committer | christos <christos@NetBSD.org> | 2006-08-21 15:26:49 +0000 |
| commit | a162f659c65e6d55ba6ae205ec8e16c288f6a647 (patch) | |
| tree | 7fd65b002eee94ac7b62a919878925944e00a44f /include | |
| parent | a4f92031c613b350c5cf163f213f2f2924984edb (diff) | |
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>.
Diffstat (limited to 'include')
| -rw-r--r-- | include/stddef.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/stddef.h b/include/stddef.h index 589d90e01d8..81ff7cdb074 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -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_ */ |
