aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-06-16 21:14:57 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-06-16 21:14:57 +0000
commit6d3b7fa80ed0a3598866cddaf7149bcfbb5a6086 (patch)
tree93358fb2ce7334982af66a578d396212f05b688e /include
parent246fcca3181d2881bc6fb5190b0f54403269688e (diff)
downloadexternal_llvm-6d3b7fa80ed0a3598866cddaf7149bcfbb5a6086.zip
external_llvm-6d3b7fa80ed0a3598866cddaf7149bcfbb5a6086.tar.gz
external_llvm-6d3b7fa80ed0a3598866cddaf7149bcfbb5a6086.tar.bz2
This version supports FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6721 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/Support/DataTypes.h50
1 files changed, 25 insertions, 25 deletions
diff --git a/include/Support/DataTypes.h b/include/Support/DataTypes.h
index ca27df6..9ce2210a 100644
--- a/include/Support/DataTypes.h
+++ b/include/Support/DataTypes.h
@@ -4,10 +4,10 @@
// This file is important because different host OS's define different macros,
// which makes portability tough. This file exports the following definitions:
//
-// ENDIAN_LITTLE : is #define'd if the host is little endian
-// int64_t : is a typedef for the signed 64 bit system type
-// uint64_t : is a typedef for the unsigned 64 bit system type
-// INT64_MAX : is a #define specifying the max value for int64_t's
+// LITTLE_ENDIAN: is #define'd if the host is little endian
+// int64_t : is a typedef for the signed 64 bit system type
+// uint64_t : is a typedef for the unsigned 64 bit system type
+// INT64_MAX : is a #define specifying the max value for int64_t's
//
// No library is required when using these functinons.
//
@@ -29,9 +29,24 @@
# else
# undef LITTLE_ENDIAN
# endif
-#else
-# if (BSD >= 199103)
-# include <machine/endian.h>
+#endif
+
+#ifdef __FreeBSD__
+# include <machine/endian.h>
+# if _BYTE_ORDER == _LITTLE_ENDIAN
+# ifndef LITTLE_ENDIAN
+# define LITTLE_ENDIAN 1
+# endif
+# ifdef BIG_ENDIAN
+# undef BIG_ENDIAN
+# endif
+# else
+# ifndef BIG_ENDIAN
+# define BIG_ENDIAN 1
+# endif
+# ifdef LITTLE_ENDIAN
+# undef LITTLE_ENDIAN
+# endif
# endif
#endif
@@ -44,26 +59,11 @@
# endif
#endif
-//
-// Convert the information from the header files into our own local
-// endian macros. We do this because various strange systems define both
-// BIG_ENDIAN and LITTLE_ENDIAN, and we don't want to conflict with them.
-//
-// Don't worry; once we introduce autoconf, this will look a lot nicer.
-//
-#ifdef LITTLE_ENDIAN
-#define ENDIAN_LITTLE
-#endif
-
-#ifdef BIG_ENDIAN
-#define ENDIAN_BIG
-#endif
-
-#if (defined(ENDIAN_LITTLE) && defined(ENDIAN_BIG))
-#error "Cannot define both ENDIAN_LITTLE and ENDIAN_BIG!"
+#if (defined(LITTLE_ENDIAN) && defined(BIG_ENDIAN))
+#error "Cannot define both LITTLE_ENDIAN and BIG_ENDIAN!"
#endif
-#if (!defined(ENDIAN_LITTLE) && !defined(ENDIAN_BIG)) || !defined(INT64_MAX)
+#if (!defined(LITTLE_ENDIAN) && !defined(BIG_ENDIAN)) || !defined(INT64_MAX)
#error "include/Support/DataTypes.h could not determine endianness!"
#endif