From 2fba92aa5f4ad9061430a61a4937d731132b2c02 Mon Sep 17 00:00:00 2001 From: NicJA Date: Sat, 3 Jan 2015 06:50:32 +0000 Subject: [PATCH] when using the gnu c++, our offsetof macro does not work and produces cryptic errors when used with templates, etc. use the builtin version if it is available. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@49900 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- compiler/stdc/include/aros/stdc/stddef.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/compiler/stdc/include/aros/stdc/stddef.h b/compiler/stdc/include/aros/stdc/stddef.h index 3fb93eecd8..a1ce7611a0 100644 --- a/compiler/stdc/include/aros/stdc/stddef.h +++ b/compiler/stdc/include/aros/stdc/stddef.h @@ -2,7 +2,7 @@ #define _STDC_STDDEF_H_ /* - Copyright © 1995-2012, The AROS Development Team. All rights reserved. + Copyright © 1995-2014, The AROS Development Team. All rights reserved. $Id$ Desc: C99 header file stddef.h @@ -13,6 +13,10 @@ #include #include -#define offsetof(type, field) ((size_t)(&((type *)0)->field)) +#ifdef __GNUC__ +#define offsetof(type, member) __builtin_offsetof(type, member) +#else +#define offsetof(type, member) ((size_t)(&((type *)0)->member)) +#endif #endif /* _STDC_STDDEF_H_ */ -- 2.11.4.GIT