* [PATCH] rbtree: avoid redefining offsetof
@ 2010-09-23 2:13 Mike Frysinger
2010-09-23 13:36 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-09-23 2:13 UTC (permalink / raw)
To: linux-mtd
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 <vapier@gentoo.org>
---
rbtree.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
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); \
--
1.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] rbtree: avoid redefining offsetof
2010-09-23 2:13 [PATCH] rbtree: avoid redefining offsetof Mike Frysinger
@ 2010-09-23 13:36 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2010-09-23 13:36 UTC (permalink / raw)
To: Mike Frysinger; +Cc: linux-mtd
On Wed, 2010-09-22 at 22:13 -0400, Mike Frysinger wrote:
> 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 <vapier@gentoo.org>
Pushed to mtd-utils, thanks!
--
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-09-23 13:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-23 2:13 [PATCH] rbtree: avoid redefining offsetof Mike Frysinger
2010-09-23 13:36 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).