diff mbox

ui/cocoa.m: Fix recent compile breakage

Message ID 51752DD3.3070302@redhat.com
State Accepted
Commit 8593e050871c632e245190725b11f1e10c629ff2
Headers show

Commit Message

Paolo Bonzini April 22, 2013, 12:32 p.m. UTC
Il 22/04/2013 13:51, Peter Maydell ha scritto:
> On 22 April 2013 00:03, Andreas Färber <andreas.faerber@web.de> wrote:
>> Even after this has been applied, things are still not building for me.
>>
>> I'm seeing CC trace/generated-events.o failing with "error: parameter
>> name omitted" for trace_apic_local_deliver, trace_usb_xhci_queue_event,
>> trace_megasas_msix_raise and trace_spapr_pci_msi_setup, plus a warning
>> that trace_event_count is being declared twice.
> 
> I suspect that whatever compiler you're using here treats 'vector'
> as a magic word, so when it sees a prototype like
>   static inline void trace_megasas_msix_raise(int vector)
> 
> it's expecting that 'vector' is an attribute of the type and
> it wants "int vector foo", hence the error message.
> 
> You could test this theory by changing all the 'vector's in
> trace-events to 'vec' instead and rebuilding.

The culprit is likely altivec.h.

Something like this should fix it:


Paolo
diff mbox

Patch

diff --git a/include/qemu-common.h b/include/qemu-common.h
index 2cfb1f0..6c23b1b 100644
--- a/include/qemu-common.h
+++ b/include/qemu-common.h
@@ -436,12 +436,18 @@ 
 /* 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>