For new gcc headers, offsetof() is defined, the definition in list.h will be warned as redefined. This patch checks whether offsetof() is defined, and only defines local version of offsetof() when it is not defined by gcc headers. Signed-off-by: Coly Li <colyli@xxxxxxx> --- list.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/list.h b/list.h index 55d2bb4..458281d 100644 --- a/list.h +++ b/list.h @@ -25,10 +25,12 @@ */ /*@{*/ +#ifndef offsetof /** * Get offset of a member */ #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif /* offsetof*/ /** * Casts a member of a structure out to the containing structure -- 2.26.2