From 5ac748832661e7924bafd06830a247b6ff34c8c3 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Wed, 22 Sep 2010 22:13:40 -0400 Subject: rbtree: avoid redefining offsetof Newer versions of gcc will define & export offsetof, so we don't want to unconditionally define it. Otherwise we hit: In file included from mkfs.jffs2.c:76:0: rbtree.h:134:0: warning: "offsetof" redefined /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.1/include/stddef.h:411:0: note: this is the location of the previous definition Signed-off-by: Mike Frysinger Signed-off-by: Artem Bityutskiy --- rbtree.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rbtree.h b/rbtree.h index 9597b10..e64dc9a 100644 --- a/rbtree.h +++ b/rbtree.h @@ -131,7 +131,10 @@ static inline void rb_set_color(struct rb_node *rb, int color) #define RB_ROOT (struct rb_root) { NULL, } +/* Newer gcc versions take care of exporting this */ +#ifndef offsetof #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#endif #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ -- cgit v1.2.3