Skip to contentSkip to conversation

qemu-common: Resolve vector build breakes for AltiVec

PATCH Applied Andreas Färber 2 participants 2 messages May 15, 2013 – May 16, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu-common: Resolve vector build breakes for AltiVec

From: Paolo Bonzini <[email protected]>

On Mac OS X ppc, altivec.h defines "vector", leading to build breakage when used as variable name, e.g. in tracing code.
Fix this by undefining identifiers after altivec.h inclusion.

---
 include/qemu-common.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
include/qemu-common.h +8 -2
index b399d85..9aff292 100644
@@ -436,12 +436,18 @@ void hexdump(const char *buf, FILE *fp, const char *prefix, size_t size);
 /* vector definitions */
 #ifdef __ALTIVEC__
 #include <altivec.h>
-#define VECTYPE        vector unsigned char
+/* The altivec.h header says we're allowed to undef these for
+ * C++ compatibility.  Here we don't care about C++, but we
+ * undef them anyway to avoid namespace pollution.
+ */
+#undef vector
+#undef pixel
+#undef bool
+#define VECTYPE        __vector unsigned char
 #define SPLAT(p)       vec_splat(vec_ld(0, p), 0)
 #define ALL_EQ(v1, v2) vec_all_eq(v1, v2)
 /* altivec.h may redefine the bool macro as vector type.
  * Reset it to POSIX semantics. */
-#undef bool
 #define bool _Bool
 #elif defined __SSE2__
 #include <emmintrin.h>
Signature · 1 line
1.8.1.4