Skip to contentSkip to conversation

nds32: define __NDS32_E[BL]__ for sparse

PATCH In review Luc Van Oostenryck 2 participants 2 messages May 28, 2018 – May 29, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nds32: define __NDS32_E[BL]__ for sparse

nds32 depends on the macros '__NDS32_E[BL]__' to correctly select or define endian-specific macros, structures or pieces of code.

These macros are predefined by the compiler but sparse knows nothing about them and thus may pre-process files differently from what GCC would.

Fix this by adding '-D__NDS32_E[BL]__' to CHECKFLAGS.

---
 arch/nds32/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/nds32/Makefile +2 -0
index 513bb2e9b..031c67682 100644
@@ -34,10 +34,12 @@ ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CFLAGS   += $(call cc-option, -EL)
 KBUILD_AFLAGS   += $(call cc-option, -EL)
 LDFLAGS         += $(call cc-option, -EL)
+CHECKFLAGS      += -D__NDS32_EL__
 else
 KBUILD_CFLAGS   += $(call cc-option, -EB)
 KBUILD_AFLAGS   += $(call cc-option, -EB)
 LDFLAGS         += $(call cc-option, -EB)
+CHECKFLAGS      += -D__NDS32_EB__
 endif
 
 boot := arch/nds32/boot
Signature · 1 line
2.17.0
Acked-by on v1 1/1
#1 lore raw

2018-05-29 0:29 GMT+08:00 Luc Van Oostenryck <[email protected]>:

Quoted 22 lines

nds32 depends on the macros '__NDS32_E[BL]__' to correctly select or define endian-specific macros, structures or pieces of code.

These macros are predefined by the compiler but sparse knows nothing about them and thus may pre-process files differently from what GCC would.

Fix this by adding '-D__NDS32_E[BL]__' to CHECKFLAGS.

---
 arch/nds32/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/nds32/Makefile +0 -0
index 513bb2e9b..031c67682 100644
@@ -34,10 +34,12 @@ ifdef CONFIG_CPU_LITTLE_ENDIAN
 KBUILD_CFLAGS   += $(call cc-option, -EL)
 KBUILD_AFLAGS   += $(call cc-option, -EL)

arch/nds32/Makefile ifdef CONFIG_CPU_LITTLE_ENDIAN · line 45

Quoted 10 lines
arch/nds32/Makefile +2 -0
 LDFLAGS         += $(call cc-option, -EL)
+CHECKFLAGS      += -D__NDS32_EL__
 else
 KBUILD_CFLAGS   += $(call cc-option, -EB)
 KBUILD_AFLAGS   += $(call cc-option, -EB)
 LDFLAGS         += $(call cc-option, -EB)
+CHECKFLAGS      += -D__NDS32_EB__
 endif
 
 boot := arch/nds32/boot

Thank you Luc.
I'll pick it in my tree.