[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] get qemu to compile as 64-bit on Mac
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH] get qemu to compile as 64-bit on Mac |
Date: |
Tue, 3 Jun 2008 10:52:13 +0200 |
Hi Dscho,
Am 03.06.2008 um 00:44 schrieb Johannes Schindelin:
+#ifndef __APPLE__
+//Apple has this already defined, this would just mess things up
#define inline always_inline
+#endif
Would it not make more sense to say
#ifndef inline
Hmm?
Multiple patches for this general Leopard problem have already been
posted without review, thanks for taking a look.
The section above the snippet is as follows:
#ifndef always_inline
#if (__GNUC__ < 3) || defined(__APPLE__)
#define always_inline inline
#else
#define always_inline __attribute__ (( always_inline )) __inline__
#endif
#endif
The line "#define always_inline inline" is executed on Leopard, and we
then seem to get a recursive definition of inline and always_inline
iiuc. Therefore I had suggested to negate always_inline's condition:
+#if !((__GNUC__ < 3) || defined(__APPLE__))
#define inline always_inline
+#endif
Alexander had proposed the simpler
+#ifndef __APPLE__
#define inline always_inline
+#endif
I only tested it on OSX gcc3+, so I can't tell whether there is any
non-Apple case that needs fixing.
Your suggested "#ifndef inline" does not work on OSX Leopard i386, it
leads to the same initial problem of:
In file included from /Users/andreas/QEMU/qemu/host-utils.c:27:
/Users/andreas/QEMU/qemu/host-utils.h:56: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:86: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:91: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:104: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:109: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:141: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:146: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:159: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:164: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:173: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:183: error: syntax error before
‘int’
/Users/andreas/QEMU/qemu/host-utils.h:194: error: syntax error before
‘int’
make[1]: *** [host-utils.o] Error 1
What about this one, it looks slightly cleaner to me than our previous
suggestions:
#ifndef always_inline
#if (__GNUC__ < 3) || defined(__APPLE__)
#define always_inline inline
#else
#define always_inline __attribute__ (( always_inline )) __inline__
+#define inline always_inline
#endif
-#endif
+#else
#define inline always_inline
+#endif
This does not touch the case of always_inline being already defined,
at the cost of duplicating the "#define inline always_inline" line.
Thereby we only fix the obvious code path of QEMU defining inline and
always_inline in terms of each other.
Andreas
Leopard-always_inline-3.diff
Description: Binary data