This is a patch dealing with byte order defines I came up with while
trying to get corosync to work on arm with little endian arch.
As near as I can tell, _BYTE_ORDER (with a single leading underscore)
is undefined in any normal case... same with single underscore endian
defines.In a test program I messed with, if _BYTE_ORDER and
_LITTLE_ENDIAN are both undefined, then
#ifdef _BYTE_ORDER == _BIG_ENDIAN
evaluates to true... which is no good if you are actually on a little
endian machine and the double underscore prefix __BYTE_ORDER is equal to
__LITTLE_ENDIAN
I first ran into this in totemip.c as suggested by a helpful IRC'er
whose name I can't remember(thanks!) but I also see the same
"undefined==undefined" symptom in crypto.c
I think the crypto.c patch needs more work to handle the case where
either BYTE_ORDER or __BYTE_ORDER are undefined along with the
corresponding double or single underscore ENDIAN defines. On my debian
arm build, they are both defined so things seem to work out ok.
diff --git a/exec/totemip.c b/exec/totemip.c
index d6bb34a..cdff21f 100644
--- a/exec/totemip.c
+++ b/exec/totemip.c
@@ -472,7 +472,7 @@ int totemip_iface_check(struct totem_ip_address
*bindnet,
if (bindnet->family == AF_INET && bindnet->nodeid == 0)
{
unsigned int nodeid = 0;
memcpy (&nodeid, boundto->addr, sizeof (int));
-#if _BYTE_ORDER == _BIG_ENDIAN
+#if __BYTE_ORDER == __BIG_ENDIAN
nodeid = swab32 (nodeid);
#endif
/*
diff --git a/exec/crypto.c b/exec/crypto.c
index 1564ee8..fa1b447 100644
--- a/exec/crypto.c
+++ b/exec/crypto.c
@@ -36,9 +36,9 @@ typedef uint64_t ulong64;
#define ENDIAN_LITTLE
#elif __BYTE_ORDER == __BIG_ENDIAN
#define ENDIAN_BIG
-#elif _BYTE_ORDER == _LITTLE_ENDIAN
+#elif BYTE_ORDER == LITTLE_ENDIAN
#define ENDIAN_LITTLE
-#elif _BYTE_ORDER == _BIG_ENDIAN
+#elif BYTE_ORDER == BIG_ENDIAN
#define ENDIAN_BIG
#else
#error "cannot detect byte order"
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais