Control: tag -1 patch

On 6 January 2014 03:28, NeilBrown <ne...@suse.de> wrote:
>
> On Wed, 1 Jan 2014 04:06:44 +0000 Dimitri John Ledkov <x...@ubuntu.com> wrote:
>
> > On 1 January 2014 03:55, NeilBrown <ne...@suse.de> wrote:
> > > On Wed, 01 Jan 2014 02:49:26 +0000 Dimitri John Ledkov <x...@ubuntu.com>
> > > wrote:
> > >
> > >> I'm also CC'ing upstream author of wiggle, to look into big-endian
> > >> test-failures. Maybe it's something obvious for Neil =)
> > >
> > > There have been a lot of fixes since the 0.9.1 version currently in Debian
> > > and v1.0 has been released.
> > > I would suggest trying v1.0 and see if the test failures are fixed there 
> > > or
> > > not.
> > >
> > > I don't have access to a big-endian so I cannot easily perform the tests 
> > > and
> > > find the cause directly.
> >
> >
> > I have access to a debian porter-box big-endian (powerpc) and the
> > latest git clone also fails in similar fashion. I'll try to get the
> > logs over. I'm not sure what's the procedure for non-debian-developers
> > to gain access to those machines. But I guess I can act as a proxy.
> >
>
> I suspect the problem is in "config.h":
>
>
> /* Includes and defines for ccan files */
>
> #if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
>  #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || 
> defined(__OpenBSD__)
>   #include <machine/endian.h>
>  #else
>   #include <endian.h>
>  #endif
> #endif
> #ifdef LITTLE_ENDIAN
>  #define HAVE_LITTLE_ENDIAN 1
>  #define HAVE_BIG_ENDIAN 0
> #elif defined(BIG_ENDIAN)
>  #define HAVE_LITTLE_ENDIAN 0
>  #define HAVE_BIG_ENDIAN 1
> #else
>  #error Unknown endian
> #endif
>
>
>
> <endian.h> seems to define both LITTLE_ENDIAN and BIG_ENDIAN, so the above
> code doesn't work.
> Can you just hack it to select the 'BIG_ENDIAN' branch and see if that makes
> it work?

But of course it defines both LITTLE & BIG endian macros, as the byte
order is defined in BYTE_ORDER to the value of either LITTLE or BIG
endian (and thankfully we don't need to care about "universal" -
simultaneously big & little endian Mac OS X builds anymore...).

I've tested the attached patch and the test-suite passes on both
x86_64 (little) and powerpc (big) endian.

Would you apply this patch upstream?

-- 
Regards,

Dimitri.
From 75d82e6f85ae2fced9bd6e9b5bb870eecef7c813 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <dimitri.led...@canonical.com>
Date: Mon, 6 Jan 2014 03:57:03 +0000
Subject: [PATCH] Fix endian checks as per austin group definitions of endian.h

Debian-Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=733831
Reference: http://www.opengroup.org/austin/docs/austin_514.txt
---
 config.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/config.h b/config.h
index ecf3411..79a64b5 100644
--- a/config.h
+++ b/config.h
@@ -1,17 +1,17 @@
 
 /* Includes and defines for ccan files */
 
-#if !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
+#if !defined(BYTE_ORDER) && !defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)
  #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
   #include <machine/endian.h>
  #else
   #include <endian.h>
  #endif
 #endif
-#ifdef LITTLE_ENDIAN
+#if BYTE_ORDER == LITTLE_ENDIAN
  #define HAVE_LITTLE_ENDIAN 1
  #define HAVE_BIG_ENDIAN 0
-#elif defined(BIG_ENDIAN)
+#elif BYTE_ORDER == BIG_ENDIAN
  #define HAVE_LITTLE_ENDIAN 0
  #define HAVE_BIG_ENDIAN 1
 #else
-- 
1.8.5.2

Reply via email to