The __builtin_bswap* functions have only been introduced in gcc-4.5, not gcc-4.0. ok jasper@
33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
$OpenBSD: patch-spice_macros_h,v 1.9 2019/05/12 22:00:52 jca Exp $
|
|
|
|
__builtin_bswap16 only found in gcc-4.5+.
|
|
|
|
https://bugs.freedesktop.org/show_bug.cgi?id=94570
|
|
|
|
Index: spice/macros.h
|
|
--- spice/macros.h.orig
|
|
+++ spice/macros.h
|
|
@@ -248,7 +248,7 @@
|
|
|
|
/* Arch specific stuff for speed
|
|
*/
|
|
-#if defined (__GNUC__) && (__GNUC__ >= 4) && defined (__OPTIMIZE__)
|
|
+#if (defined(__clang__) || defined (__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 5) && defined (__OPTIMIZE__)
|
|
# define SPICE_BYTESWAP16(val) __builtin_bswap16(val)
|
|
# define SPICE_BYTESWAP32(val) __builtin_bswap32(val)
|
|
# define SPICE_BYTESWAP64(val) __builtin_bswap64(val)
|
|
@@ -268,6 +268,13 @@
|
|
#define SPICE_ENDIAN_LITTLE 4321
|
|
#define SPICE_ENDIAN_BIG 1234
|
|
#define SPICE_ENDIAN_PDP 2143
|
|
+
|
|
+#include <endian.h>
|
|
+#if BYTE_ORDER == LITTLE_ENDIAN
|
|
+# define SPICE_ENDIAN SPICE_ENDIAN_LITTLE
|
|
+#elif BYTE_ORDER == BIG_ENDIAN
|
|
+# define SPICE_ENDIAN SPICE_ENDIAN_BIG
|
|
+#endif
|
|
|
|
/* gcc already defined these, use them */
|
|
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) \
|