aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2012-11-27 14:18:04 -0800
committerElliott Hughes <enh@google.com>2012-11-27 14:18:04 -0800
commitb15c58bb0fe55f076751acd7a5d00ded0ec33963 (patch)
treea77604250097aa29d362334783e7f4d9277efa67
parentf2de6b0f6e873f9cb28682b8fc6764b0ab41c6ee (diff)
downloadandroid_bionic-b15c58bb0fe55f076751acd7a5d00ded0ec33963.tar.gz
android_bionic-b15c58bb0fe55f076751acd7a5d00ded0ec33963.tar.bz2
android_bionic-b15c58bb0fe55f076751acd7a5d00ded0ec33963.zip
Clean up _BYTE_ORDER definitions for better x86 portability.
We'd manually hacked _BYTE_ORDER into the arm and mips "_types.h" headers, but not into the x86 one. Judging by upstream, _BYTE_ORDER should be in the "endian.h" headers instead, so let's uniformly do that. I've also ironed out some of the other differences between the different architectures' header files too. Bug: http://code.google.com/p/android/issues/detail?id=39824 Change-Id: I19d3af7ffd74e1c02b1b6886aec0f0d11f44ab8d
-rw-r--r--libc/arch-arm/include/endian.h2
-rw-r--r--libc/arch-arm/include/machine/_types.h6
-rw-r--r--libc/arch-mips/include/endian.h21
-rw-r--r--libc/arch-mips/include/machine/_types.h6
-rw-r--r--libc/arch-x86/include/endian.h1
5 files changed, 9 insertions, 27 deletions
diff --git a/libc/arch-arm/include/endian.h b/libc/arch-arm/include/endian.h
index 6de0889ef..7cba3b942 100644
--- a/libc/arch-arm/include/endian.h
+++ b/libc/arch-arm/include/endian.h
@@ -77,7 +77,7 @@
#endif /* __ARM_ARCH__ */
#endif /* __GNUC__ */
-#ifdef __ARMEB__
+#if defined(__ARMEB__)
#define _BYTE_ORDER _BIG_ENDIAN
#else
#define _BYTE_ORDER _LITTLE_ENDIAN
diff --git a/libc/arch-arm/include/machine/_types.h b/libc/arch-arm/include/machine/_types.h
index 3e779ca85..dbc4e9d74 100644
--- a/libc/arch-arm/include/machine/_types.h
+++ b/libc/arch-arm/include/machine/_types.h
@@ -116,10 +116,4 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#ifdef __ARMEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-
#endif /* _ARM__TYPES_H_ */
diff --git a/libc/arch-mips/include/endian.h b/libc/arch-mips/include/endian.h
index 6d4ca4e82..41a9004f4 100644
--- a/libc/arch-mips/include/endian.h
+++ b/libc/arch-mips/include/endian.h
@@ -29,17 +29,6 @@
#ifndef _MIPS64_ENDIAN_H_
#define _MIPS64_ENDIAN_H_
-#if defined(__MIPSEL__)
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-#if defined(__MIPSEB__)
-#define _BYTE_ORDER _BIG_ENDIAN
-#endif
-
-#if !defined(_BYTE_ORDER) && !defined(lint)
-#error "__MIPSEL__ or __MIPSEB__ must be defined to define BYTE_ORDER!!!"
-#endif
-
#ifdef __GNUC__
#if defined(__mips_isa_rev) && (__mips_isa_rev >= 2)
@@ -69,9 +58,13 @@
#endif /* __mips32r2__ */
#endif /* __GNUC__ */
-
+#if defined(__MIPSEB__)
+#define _BYTE_ORDER _BIG_ENDIAN
+#else
+#define _BYTE_ORDER _LITTLE_ENDIAN
+#endif
+#define __STRICT_ALIGNMENT
+#include <sys/types.h>
#include <sys/endian.h>
-#define __STRICT_ALIGNMENT
-
#endif /* _MIPS64_ENDIAN_H_ */
diff --git a/libc/arch-mips/include/machine/_types.h b/libc/arch-mips/include/machine/_types.h
index 1cc6c21a1..52ccdffb4 100644
--- a/libc/arch-mips/include/machine/_types.h
+++ b/libc/arch-mips/include/machine/_types.h
@@ -124,12 +124,6 @@ typedef int __rune_t;
typedef void * __wctrans_t;
typedef void * __wctype_t;
-#ifdef __MIPSEB__
-#define _BYTE_ORDER _BIG_ENDIAN
-#else
-#define _BYTE_ORDER _LITTLE_ENDIAN
-#endif
-
#if defined(_KERNEL)
typedef struct label_t {
__register_t val[14];
diff --git a/libc/arch-x86/include/endian.h b/libc/arch-x86/include/endian.h
index 4a705364e..e7ad25784 100644
--- a/libc/arch-x86/include/endian.h
+++ b/libc/arch-x86/include/endian.h
@@ -65,6 +65,7 @@
#endif /* __GNUC__ */
#define _BYTE_ORDER _LITTLE_ENDIAN
+#include <sys/types.h>
#include <sys/endian.h>
#endif /* _I386_ENDIAN_H_ */