Patchwork [U-Boot,v2,04/25] include/linux/stddef.h: avoid 'warning: preprocessor token offsetof redefined'

login
register
mail settings
Submitter Kim Phillips
Date Oct. 29, 2012, 11:34 p.m.
Message ID <1351553687-12469-5-git-send-email-kim.phillips@freescale.com>
Download mbox | patch
Permalink /patch/195152/
State Accepted
Delegated to: Tom Rini
Headers show

Comments

Kim Phillips - Oct. 29, 2012, 11:34 p.m.
hack to avoid:

/opt/gcc-4.6.3-nolibc/powerpc-linux/bin/../lib/gcc/powerpc-linux/4.6.3/include/stddef.h:413:9: warning: preprocessor token offsetof redefined
u-boot/include/linux/stddef.h:20:9: this was the original definition

tried protecting with __KERNEL__, and #including compiler.h first.

Even tried include dir reordering to no avail:

 +++ b/config.mk
 @@ -194,7 +194,11 @@ OBJCFLAGS += --gap-fill=0xff
 gccincdir := $(shell $(CC) -print-file-name=include)

 CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS)                \
 -       -D__KERNEL__
 +       -D__KERNEL__  \
 +       -I $(gccincdir) \
 +       -nostdinc
 +
 +#      -isystem $(gccincdir) \

 # Enable garbage collection of un-used sections for SPL
 ifeq ($(CONFIG_SPL_BUILD),y)
 @@ -227,8 +231,7 @@ CPPFLAGS += -I$(OBJTREE)/include2 -I$(OBJTREE)/include
 endif

 CPPFLAGS += -I$(TOPDIR)/include
 -CPPFLAGS += -fno-builtin -ffreestanding -nostdinc      \
 -       -isystem $(gccincdir) -pipe $(PLATFORM_CPPFLAGS)
 +CPPFLAGS += -fno-builtin -ffreestanding -pipe $(PLATFORM_CPPFLAGS)

Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
v2: no change

 include/linux/stddef.h | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/include/linux/stddef.h b/include/linux/stddef.h
index 81e34c2..c540f61 100644
--- a/include/linux/stddef.h
+++ b/include/linux/stddef.h
@@ -12,7 +12,9 @@ 
 #include <linux/types.h>
 #endif
 
+#ifndef __CHECKER__
 #undef offsetof
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
+#endif
 
 #endif