How about: ---- 8< ---- diff --git a/sha1dc/sha1.c b/sha1dc/sha1.c index facea1bb5..ed8c63f2d 100644 --- a/sha1dc/sha1.c +++ b/sha1dc/sha1.c @@ -38,9 +38,18 @@ #if (defined(_BYTE_ORDER) || defined(__BYTE_ORDER) || defined(__BYTE_ORDER__)) +#define EMPTY_VAL(x) x ## 1 +#define EMPTY(x) EMPTY_VAL(x) + +#if (defined(_BIG_ENDIAN) && (EMPTY(_BIG_ENDIAN) == 1)) +#undef _BIG_ENDIAN +#define _BIG_ENDIAN 4321 +#endif + #if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \ (defined(__BYTE_ORDER) && (__BYTE_ORDER == __BIG_ENDIAN)) || \ - (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) ) + (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __BIG_ENDIAN__)) || \ + (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == _BIG_ENDIAN)) ) #define SHA1DC_BIGENDIAN #endif * Michael Kebe <michael.kebe@xxxxxxxxx> [170627 02:28]: > On the Solaris system here __BYTE_ORDER__ set to 4321 and _BIG_ENDIAN > is defined, but has no value. > > The problem is the not short circuiting macro... > > -------------------------8<------------------------------ > #undef _FOO1 > #undef _FOO2 > #undef _FOO2 > > #undef _BAR1 > #undef _BAR2 > #undef _BAR3 > > #define _FOO3 42 > > //comment out this line or give it a value to make the preprocesser happy > #define _BAR1 > > #if (defined(_FOO1) || defined(_FOO2) || defined(_FOO3)) > > // not short circuiting... preprocesser tries to evaluate (_FOO1 && > _BAR1) but _BAR1 has no value... > #if ((defined(_FOO1) && (_FOO1 == _BAR1)) || \ > (defined(_FOO2) && (_FOO2 == _BAR2)) || \ > (defined(_FOO3) && (_FOO3 == BAR3)) ) > #define SHA1DC_BIGENDIAN > #endif > > #endif > -------------------------8<------------------------------ > https://gist.github.com/michaelkebe/c963c7478b7b55ad197f0665986870d4 > > What do you think? > > 2017-06-27 7:41 GMT+02:00 Michael Kebe <michael.kebe@xxxxxxxxx>: > > 2017-06-26 22:27 GMT+02:00 Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>: > >> Could you (or anyone else for that matter) please test it with: > >> > >> git clone --branch bigend-detect-solaris-again https://github.com/avar/sha1collisiondetection.git && > >> cd sha1collisiondetection && > >> make test > > > > Still no luck. > > > > ~/sha1collisiondetection (bigend-detect-solaris-again *)$ CC=gcc gmake test > > mkdir -p dep_lib && gcc -O2 -Wall -Werror -Wextra -pedantic -std=c90 > > -Ilib -M -MF dep_lib/sha1.d lib/sha1.c > > lib/sha1.c:63:58: error: operator '==' has no right operand > > #if ((defined(_BYTE_ORDER) && (_BYTE_ORDER == _BIG_ENDIAN)) || \ > > ^ > > > > Running Solaris on sparc: > > $ uname -a > > SunOS er202 5.11 11.3 sun4v sparc sun4v > > > > > > The isa_defs.h is available here: > > https://gist.github.com/michaelkebe/472720cd684b5b2a504b8eeb24049870 > > > > > > Greetings > > Michael