Do not detect byte-order using _BIG/_LITTLE_ENDIAN

These defines are present on some FreeBSD systems, regardless of
whether the system is big- or little- endian. This was causing the
FreeBSD CI to be incorrectly flagged as big-endian.

Resolves https://github.com/ziglang/zig/issues/11391
This commit is contained in:
Cody Tapscott 2022-04-09 05:09:36 -07:00
parent 04dd43934a
commit 319b5cbce5

View File

@ -17,8 +17,6 @@
#define BIGENDIAN 1
#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define BIGENDIAN 1
#elif defined(_BIG_ENDIAN)
#define BIGENDIAN 1
#elif defined(__sparc)
#define BIGENDIAN 1
#elif defined(__sparc__)
@ -37,7 +35,9 @@
#define BIGENDIAN 1
#elif defined(__s390__)
#define BIGENDIAN 1
#elif defined(__LITTLE_ENDIAN__)
#endif
#if defined(__LITTLE_ENDIAN__)
#define LITTLEENDIAN 1
#elif defined(__ARMEL__)
#define LITTLEENDIAN 1
@ -53,8 +53,6 @@
#define LITTLEENDIAN 1
#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define LITTLEENDIAN 1
#elif defined(_LITTLE_ENDIAN)
#define LITTLEENDIAN 1
#elif defined(__i386__)
#define LITTLEENDIAN 1
#elif defined(__alpha__)
@ -83,7 +81,11 @@
#define LITTLEENDIAN 1
#elif defined(__bfin__)
#define LITTLEENDIAN 1
#else
#endif
#if defined(LITTLEENDIAN) && defined(BIGENDIAN)
#error unable to detect endianness
#elif !defined(LITTLEENDIAN) && !defined(BIGENDIAN)
#error unable to detect endianness
#endif