qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2 2/4] softfloat: Avoid uint16 type conflict on


From: Eric Sunshine
Subject: Re: [Qemu-devel] [PATCH v2 2/4] softfloat: Avoid uint16 type conflict on Darwin
Date: Tue, 1 Nov 2011 04:09:20 -0400

On Oct 31, 2011, at 3:18 PM, Andreas Färber wrote:
In file included from ./bswap.h:7,
                from ./qemu-common.h:106,
                from ./qemu-aio.h:17,
                from ./Block.h:4,
from /System/Library/Frameworks/ CoreServices.framework/Frameworks/CarbonCore.framework/Headers/ FSEvents.h:28, from /System/Library/Frameworks/ CoreServices.framework/Frameworks/CarbonCore.framework/Headers/ CarbonCore.h:218, from /System/Library/Frameworks/ CoreServices.framework/Frameworks/AE.framework/Headers/AE.h:20, from /System/Library/Frameworks/ CoreServices.framework/Headers/CoreServices.h:21, from /System/Library/Frameworks/Foundation.framework/ Headers/NSURLError.h:17, from /System/Library/Frameworks/Foundation.framework/ Headers/Foundation.h:81, from /System/Library/Frameworks/Cocoa.framework/ Headers/Cocoa.h:12,
                from ui/cocoa.m:25:
/Users/andreas/QEMU/qemu/fpu/softfloat.h:60: error: conflicting types for ‘uint16’ /System/Library/Frameworks/Security.framework/Headers/cssmconfig.h: 73: error: previous declaration of ‘uint16’ was here
make: *** [ui/cocoa.o] Error 1

Apple's FSEvents.h has #include <Block.h>, which wants
/usr/include/Block.h but due to case-insensitive file system and
include path jungle gets QEMU's ./block.h, which in turn includes
softfloat.h indirectly.

Therefore work around the conflict in softfloat.h itself
by renaming specifically uint16 on Darwin to qemu_uint16.
This fixes the build until we have a more general solution.

Signed-off-by: Andreas Färber <address@hidden>
Cc: Juan Pineda <address@hidden>
Cc: Peter Maydell <address@hidden>
---
fpu/softfloat.h |    3 +++
1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..5320945 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -54,6 +54,9 @@ these four paragraphs for those parts of this code that are retained.
| to the same as `int'.
*----------------------------------------------------------------------------*/
typedef uint8_t flag;
+#ifdef __APPLE__
+#define uint16 qemu_uint16
+#endif
typedef uint8_t uint8;
typedef int8_t int8;
#ifndef _AIX

Perhaps the following alternative solution would be more palatable? It's still tremendously ugly, but is localized to cocoa.m, thus less intrusive.

-- >8 --
Subject: [PATCH] softfloat: Avoid uint16 type conflict on Darwin

cocoa.m includes <Security/cssmconfig.h> indirectly via <Cocoa/Cocoa.h>.
cssmconfig.h defines type uint16 which unfortunately conflicts with the
definition in qemu's softfloat.h, thus resulting in compilation failure.
To work around the problem, #define _UINT16, which informs cssmconfig.h
that uint16 is already defined and that it should not apply its own
definition. Additionally, ensure that <Cocoa/Cocoa.h> is included after
softfloat.h rather than before since some Cocoa headers expect type
uint16 to exist.

Signed-off-by: Eric Sunshine <address@hidden>
---
 ui/cocoa.m |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/ui/cocoa.m b/ui/cocoa.m
index d9e4e3d..ac15418 100644
--- a/ui/cocoa.m
+++ b/ui/cocoa.m
@@ -22,13 +22,14 @@
  * THE SOFTWARE.
  */

-#import <Cocoa/Cocoa.h>
-#include <crt_externs.h>
-
 #include "qemu-common.h"
 #include "console.h"
 #include "sysemu.h"

+#define _UINT16
+#import <Cocoa/Cocoa.h>
+#include <crt_externs.h>
+
 #ifndef MAC_OS_X_VERSION_10_4
 #define MAC_OS_X_VERSION_10_4 1040
 #endif
--
1.7.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]