Use __builtin_offsetof for GCC 4.1.
This commit is contained in:
parent
c9b2659ee8
commit
a5ba0f4e08
@ -304,6 +304,9 @@
|
||||
* We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
|
||||
* require it.
|
||||
*/
|
||||
#if __GNUC_PREREQ__(4, 1)
|
||||
#define __offsetof(type, field) __builtin_offsetof(type, field)
|
||||
#else
|
||||
#ifndef __cplusplus
|
||||
#define __offsetof(type, field) ((size_t)(&((type *)0)->field))
|
||||
#else
|
||||
@ -312,6 +315,7 @@
|
||||
(&reinterpret_cast <const volatile char &> \
|
||||
(static_cast<type *> (0)->field))))
|
||||
#endif
|
||||
#endif
|
||||
#define __rangeof(type, start, end) \
|
||||
(__offsetof(type, end) - __offsetof(type, start))
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user