From 8539af7bbb41680568ecd23b0e2b258037504749 Mon Sep 17 00:00:00 2001 From: Eric Christopher Date: Thu, 20 Sep 2012 06:19:20 +0000 Subject: [PATCH] Both OpenBSD and Bitrig need to include machine/endian.h to get the _BYTE_ORDER define. Patch by David Hill. llvm-svn: 164286 --- compiler-rt/lib/int_endianness.h | 15 ++++++++++++++- compiler-rt/test/Unit/endianness.h | 15 +++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/compiler-rt/lib/int_endianness.h b/compiler-rt/lib/int_endianness.h index 70bd17730cb2..edb58c810e21 100644 --- a/compiler-rt/lib/int_endianness.h +++ b/compiler-rt/lib/int_endianness.h @@ -31,7 +31,7 @@ /* .. */ -#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__minix) +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined(__minix) #include #if _BYTE_ORDER == _BIG_ENDIAN @@ -44,6 +44,19 @@ #endif /* *BSD */ +#if defined(__OpenBSD__) || defined(__Bitrig__) +#include + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* OpenBSD and Bitrig. */ + /* .. */ /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ diff --git a/compiler-rt/test/Unit/endianness.h b/compiler-rt/test/Unit/endianness.h index 669e6f1736a9..06c53de0bfa9 100644 --- a/compiler-rt/test/Unit/endianness.h +++ b/compiler-rt/test/Unit/endianness.h @@ -51,6 +51,21 @@ /* .. */ +#if defined(__OpenBSD__) || defined(__Bitrig__) +#include + +#if _BYTE_ORDER == _BIG_ENDIAN +#define _YUGA_LITTLE_ENDIAN 0 +#define _YUGA_BIG_ENDIAN 1 +#elif _BYTE_ORDER == _LITTLE_ENDIAN +#define _YUGA_LITTLE_ENDIAN 1 +#define _YUGA_BIG_ENDIAN 0 +#endif /* _BYTE_ORDER */ + +#endif /* OpenBSD and Bitrig. */ + +/* .. */ + /* Mac OSX has __BIG_ENDIAN__ or __LITTLE_ENDIAN__ automatically set by the compiler (at least with GCC) */ #if defined(__APPLE__) && defined(__MACH__) || defined(__ellcc__ )