mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] envfs: fix build warning
@ 2010-06-24  9:04 Baruch Siach
  2010-06-24 11:10 ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2010-06-24  9:04 UTC (permalink / raw)
  To: barebox

__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@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] envfs: fix build warning
  2010-06-24  9:04 [PATCH] envfs: fix build warning Baruch Siach
@ 2010-06-24 11:10 ` Sascha Hauer
  2010-06-24 11:19   ` Baruch Siach
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2010-06-24 11:10 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

On Thu, Jun 24, 2010 at 12:04:59PM +0300, Baruch Siach wrote:
> __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.

Maybe we should rather define __LITTLE_ENDIAN and __BIG_ENDIAN
in include/linux/byteorder.h. We do not seem to have any
#ifdef __XX_ENDIAN left in the code.

Sascha

> 
> Signed-off-by: Baruch Siach <baruch@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
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] envfs: fix build warning
  2010-06-24 11:10 ` Sascha Hauer
@ 2010-06-24 11:19   ` Baruch Siach
  2010-06-24 11:35     ` Sascha Hauer
  0 siblings, 1 reply; 5+ messages in thread
From: Baruch Siach @ 2010-06-24 11:19 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

On Thu, Jun 24, 2010 at 01:10:30PM +0200, Sascha Hauer wrote:
> On Thu, Jun 24, 2010 at 12:04:59PM +0300, Baruch Siach wrote:
> > __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.
> 
> Maybe we should rather define __LITTLE_ENDIAN and __BIG_ENDIAN
> in include/linux/byteorder.h.

You mean include/linux/byteorder/generic.h? I now see that __LITTLE_ENDIAN and 
__BIG_ENDIAN are defined in include/linux/byteorder/little_endian.h and 
include/linux/byteorder/big_endian.h respectively. Should we add their 
complement?

baruch

> We do not seem to have any
> #ifdef __XX_ENDIAN left in the code.
> 
> Sascha
> 
> > 
> > Signed-off-by: Baruch Siach <baruch@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
> > 
> > 
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch@tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] envfs: fix build warning
  2010-06-24 11:19   ` Baruch Siach
@ 2010-06-24 11:35     ` Sascha Hauer
  2010-06-27  5:46       ` [PATCH] byteorder: add missing {BIG,LITTLE}_ENDIAN defines Baruch Siach
  0 siblings, 1 reply; 5+ messages in thread
From: Sascha Hauer @ 2010-06-24 11:35 UTC (permalink / raw)
  To: Baruch Siach; +Cc: barebox

On Thu, Jun 24, 2010 at 02:19:17PM +0300, Baruch Siach wrote:
> Hi Sascha,
> 
> On Thu, Jun 24, 2010 at 01:10:30PM +0200, Sascha Hauer wrote:
> > On Thu, Jun 24, 2010 at 12:04:59PM +0300, Baruch Siach wrote:
> > > __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.
> > 
> > Maybe we should rather define __LITTLE_ENDIAN and __BIG_ENDIAN
> > in include/linux/byteorder.h.
> 
> You mean include/linux/byteorder/generic.h? I now see that __LITTLE_ENDIAN and 
> __BIG_ENDIAN are defined in include/linux/byteorder/little_endian.h and 
> include/linux/byteorder/big_endian.h respectively. Should we add their 
> complement?

Yes.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] byteorder: add missing {BIG,LITTLE}_ENDIAN defines
  2010-06-24 11:35     ` Sascha Hauer
@ 2010-06-27  5:46       ` Baruch Siach
  0 siblings, 0 replies; 5+ messages in thread
From: Baruch Siach @ 2010-06-27  5:46 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

This fixes build warnings when testing __BYTE_ORDER of the other kind.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
---
 include/linux/byteorder/generic.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/include/linux/byteorder/generic.h b/include/linux/byteorder/generic.h
index cff850f..aab8f4b 100644
--- a/include/linux/byteorder/generic.h
+++ b/include/linux/byteorder/generic.h
@@ -78,6 +78,12 @@
  *
  */
 
+#ifndef __LITTLE_ENDIAN
+#define __LITTLE_ENDIAN	1234
+#endif
+#ifndef __BIG_ENDIAN
+#define __BIG_ENDIAN	4321
+#endif
 
 #if defined(__KERNEL__)
 /*
-- 
1.7.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-27  5:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-24  9:04 [PATCH] envfs: fix build warning Baruch Siach
2010-06-24 11:10 ` Sascha Hauer
2010-06-24 11:19   ` Baruch Siach
2010-06-24 11:35     ` Sascha Hauer
2010-06-27  5:46       ` [PATCH] byteorder: add missing {BIG,LITTLE}_ENDIAN defines Baruch Siach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox