]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[build] Really use __builtin_offsetof() when available
authorArkadiusz Miskiewicz <arekm@maven.pl>
Sun, 28 Nov 2010 18:28:15 +0000 (18:28 +0000)
committerMichael Brown <mcb30@ipxe.org>
Sun, 28 Nov 2010 18:28:15 +0000 (18:28 +0000)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/include/stddef.h

index 8e69545c292b2c8c42f511b74ede0a1be2f80e33..c91a103f836f2aa85110a04f653477d8ddba4fe1 100644 (file)
@@ -10,8 +10,8 @@ FILE_LICENCE ( GPL2_ONLY );
 #define NULL ((void *)0)
 
 #undef offsetof
-#ifdef __compiler_offsetof
-#define offsetof(TYPE,MEMBER) __compiler_offsetof(TYPE,MEMBER)
+#if ( defined ( __GNUC__ ) && ( __GNUC__ > 3 ) )
+#define offsetof(TYPE, MEMBER) __builtin_offsetof(TYPE, MEMBER)
 #else
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 #endif