Browse Source

[build] Really use __builtin_offsetof() when available

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Arkadiusz Miskiewicz 14 years ago
parent
commit
719f2d793c
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      src/include/stddef.h

+ 2
- 2
src/include/stddef.h View File

10
 #define NULL ((void *)0)
10
 #define NULL ((void *)0)
11
 
11
 
12
 #undef offsetof
12
 #undef offsetof
13
-#ifdef __compiler_offsetof
14
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
13
+#if ( defined ( __GNUC__ ) && ( __GNUC__ > 3 ) )
14
+#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
15
 #else
15
 #else
16
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
16
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
17
 #endif
17
 #endif

Loading…
Cancel
Save