[PATCH] envfs: fix build warning

Baruch Siach baruch at tkos.co.il
Thu Jun 24 05:04:59 EDT 2010


__LITTLE_ENDIAN or __BIG_ENDIAN are not always defined. E.g. the CodeSourcery
G++ Lite 2010q1 for ARM (4.4.1) does not define __BIG_ENDIAN. This causes a
compile time warning.

Signed-off-by: Baruch Siach <baruch at tkos.co.il>
---
 include/envfs.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/envfs.h b/include/envfs.h
index b5849d9..0dd4e6a 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -36,7 +36,7 @@ struct envfs_super {
 #error "No byte order defined in __BYTE_ORDER"
 #endif
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if defined(__LITTLE_ENDIAN) && __BYTE_ORDER == __LITTLE_ENDIAN
 #define ENVFS_16(x)	(x)
 #define ENVFS_24(x)	(x)
 #define ENVFS_32(x)	(x)
@@ -44,7 +44,7 @@ struct envfs_super {
 #define ENVFS_GET_OFFSET(x)	((x)->offset)
 #define ENVFS_SET_OFFSET(x,y)	((x)->offset = (y))
 #define ENVFS_SET_NAMELEN(x,y) ((x)->namelen = (y))
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif defined(__BIG_ENDIAN) && __BYTE_ORDER == __BIG_ENDIAN
 #ifdef __KERNEL__
 #define ENVFS_16(x)	swab16(x)
 #define ENVFS_24(x)	((swab32(x)) >> 8)
-- 
1.7.1




More information about the barebox mailing list