Fix gcc version check to unbreak on base-gcc platforms
The __builtin_bswap* functions have only been introduced in gcc-4.5, not gcc-4.0. ok jasper@
This commit is contained in:
parent
b799be6324
commit
c2525adf70
@ -1,8 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.22 2018/06/23 14:43:53 ajacoutot Exp $
|
||||
# $OpenBSD: Makefile,v 1.23 2019/05/12 22:00:52 jca Exp $
|
||||
|
||||
COMMENT= SPICE protocol headers
|
||||
|
||||
DISTNAME= spice-protocol-0.12.14
|
||||
REVISION= 0
|
||||
CATEGORIES= devel net
|
||||
|
||||
HOMEPAGE= http://www.spice-space.org/
|
||||
|
@ -1,21 +1,32 @@
|
||||
$OpenBSD: patch-spice_macros_h,v 1.8 2018/06/23 14:43:54 ajacoutot Exp $
|
||||
$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
|
||||
@@ -269,6 +269,13 @@
|
||||
@@ -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__) \
|
||||
&& defined(__ORDER_BIG_ENDIAN__) && defined(__ORDER_PDP_ENDIAN__)
|
||||
|
Loading…
Reference in New Issue
Block a user