Patchwork [v3,2/4] softfloat: Avoid uint16 type conflict on Darwin

login
register
mail settings
Submitter Andreas Färber
Date Nov. 1, 2011, 5:59 p.m.
Message ID <1320170376-21605-1-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/123112/
State New
Headers show

Comments

Andreas Färber - Nov. 1, 2011, 5:59 p.m.
On Mac OS X we get:

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 reusing uint16 from Security/cssmconfig.h on Darwin.
This fixes the build until we have a more general solution.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Eric Sunshine <sunshine@sunshineco.com>
Cc: Juan Pineda <juan@logician.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
---
 fpu/softfloat.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Peter Maydell - Nov. 1, 2011, 6:01 p.m.
On 1 November 2011 17:59, Andreas Färber <andreas.faerber@web.de> wrote:
> 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.

Incidentally, surely you need to fix this anyway (ie fix the
include path issue somehow)?

-- PMM
Andreas Färber - Nov. 1, 2011, 6:05 p.m.
Am 01.11.2011 19:01, schrieb Peter Maydell:
> On 1 November 2011 17:59, Andreas Färber <andreas.faerber@web.de> wrote:
>> 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.
> 
> Incidentally, surely you need to fix this anyway (ie fix the
> include path issue somehow)?

Yes, that's why I'm explicitly documenting it. I have no clue how to fix
it though. Experts' opinion welcome!

Andreas
Andreas Färber - Nov. 1, 2011, 6:17 p.m.
Am 01.11.2011 18:59, schrieb Andreas Färber:
> On Mac OS X we get:
> 
> 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 reusing uint16 from Security/cssmconfig.h on Darwin.
> This fixes the build until we have a more general solution.
> 
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> Cc: Eric Sunshine <sunshine@sunshineco.com>
> Cc: Juan Pineda <juan@logician.com>
> Cc: Peter Maydell <peter.maydell@linaro.org>

v3 series is available from
git://repo.or.cz/qemu/afaerber.git cocoa-for-upstream

If no further protest arises, I'll send a pull request later today.

Andreas

> ---
>  fpu/softfloat.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fpu/softfloat.h b/fpu/softfloat.h
> index 07c2929..229d834 100644
> --- a/fpu/softfloat.h
> +++ b/fpu/softfloat.h
> @@ -57,7 +57,9 @@ typedef uint8_t flag;
>  typedef uint8_t uint8;
>  typedef int8_t int8;
>  #ifndef _AIX
> +#if !(defined(__APPLE__) && defined(_UINT16))
>  typedef int uint16;
> +#endif
>  typedef int int16;
>  #endif
>  typedef unsigned int uint32;
Eric Sunshine - Nov. 1, 2011, 6:55 p.m.
On Nov 1, 2011, at 2:05 PM, Andreas Färber wrote:
> Am 01.11.2011 19:01, schrieb Peter Maydell:
>> On 1 November 2011 17:59, Andreas Färber <andreas.faerber@web.de>  
>> wrote:
>>> 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.
>>
>> Incidentally, surely you need to fix this anyway (ie fix the
>> include path issue somehow)?
>
> Yes, that's why I'm explicitly documenting it. I have no clue how to  
> fix
> it though. Experts' opinion welcome!


It probably is not a good idea to emphasize the particular #include  
stack issued by this one build environment (presumably XCode on Lion?)  
so loudly in the commit message. The type redefinition error will  
manifest regardless of #include ordering and regardless of whether or  
not ./block.h is picked up accidentally instead of <Block.h>. For  
instance, on Leopard with XCode 3.1.4, the #include stack emitted with  
the error message is entirely different even though the underlying  
issue is the same:

   OBJC  ui/cocoa.o
In file included from ./bswap.h:8,
                  from ./qemu-common.h:107,
                  from ui/cocoa.m:29:
/Users/sunshine/Desktop/qemu/fpu/softfloat.h:60: error: conflicting  
types for 'uint16'
/System/Library/Frameworks/Security.framework/Headers/cssmconfig.h:68:  
error: previous declaration of 'uint16' was here
make: *** [ui/cocoa.o] Error 1

In fact, on Leopard, FSEvents.h does not #include <Block.h>, so  
focusing on it in the log message is misleading.

-- ES
Andreas Färber - Nov. 1, 2011, 7:11 p.m.
Am 01.11.2011 19:55, schrieb Eric Sunshine:
> On Nov 1, 2011, at 2:05 PM, Andreas Färber wrote:
>> Am 01.11.2011 19:01, schrieb Peter Maydell:
>>> On 1 November 2011 17:59, Andreas Färber <andreas.faerber@web.de> wrote:
>>>> 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.
>>>
>>> Incidentally, surely you need to fix this anyway (ie fix the
>>> include path issue somehow)?
>>
>> Yes, that's why I'm explicitly documenting it. I have no clue how to fix
>> it though. Experts' opinion welcome!
> 
> 
> It probably is not a good idea to emphasize the particular #include
> stack issued by this one build environment (presumably XCode on Lion?)
> so loudly in the commit message. The type redefinition error will
> manifest regardless of #include ordering and regardless of whether or
> not ./block.h is picked up accidentally instead of <Block.h>. For
> instance, on Leopard with XCode 3.1.4, the #include stack emitted with
> the error message is entirely different even though the underlying issue
> is the same:
> 
>   OBJC  ui/cocoa.o
> In file included from ./bswap.h:8,
>                  from ./qemu-common.h:107,
>                  from ui/cocoa.m:29:
> /Users/sunshine/Desktop/qemu/fpu/softfloat.h:60: error: conflicting
> types for 'uint16'
> /System/Library/Frameworks/Security.framework/Headers/cssmconfig.h:68:
> error: previous declaration of 'uint16' was here
> make: *** [ui/cocoa.o] Error 1
> 
> In fact, on Leopard, FSEvents.h does not #include <Block.h>, so focusing
> on it in the log message is misleading.

My point is, that's the reason it needs to be fixed *this* way and not
in cocoa.m like you'd expect. If it doesn't show up in git-blame, people
will not understand and "clean up". It's always just an example since it
includes user-specific paths - here Snow Leopard. Rewording.

AF

Patch

diff --git a/fpu/softfloat.h b/fpu/softfloat.h
index 07c2929..229d834 100644
--- a/fpu/softfloat.h
+++ b/fpu/softfloat.h
@@ -57,7 +57,9 @@  typedef uint8_t flag;
 typedef uint8_t uint8;
 typedef int8_t int8;
 #ifndef _AIX
+#if !(defined(__APPLE__) && defined(_UINT16))
 typedef int uint16;
+#endif
 typedef int int16;
 #endif
 typedef unsigned int uint32;