Patchwork Use of LONG_LONG_MAX breaks build on OSX ?

login
register
mail settings
Submitter Emmanuel Kasper
Date Jan. 7, 2010, 11:20 p.m.
Message ID <4B466C56.5020701@libera.cc>
Download mbox | patch
Permalink /patch/42488/
State New
Headers show

Comments

Emmanuel Kasper - Jan. 7, 2010, 11:20 p.m.
Hello
Qemu does not build on my platform ( OSX / 10.5 / PowerPC ) because of
the use of  LONG_LONG_MAX in raw-posix.c
Replacing LONG_LONG_MAX with LLONG_MAX fixes the build and is more
standard  IMHO ( LONG_LONG_MAX is GNU libc, LLONG_MAX is C99 standard )
The following patch makes this trivial switch.
Aurelien Jarno - Feb. 28, 2010, 6:07 p.m.
On Fri, Jan 08, 2010 at 12:20:54AM +0100, Emmanuel Kasper wrote:
> Hello
> Qemu does not build on my platform ( OSX / 10.5 / PowerPC ) because of
> the use of  LONG_LONG_MAX in raw-posix.c
> Replacing LONG_LONG_MAX with LLONG_MAX fixes the build and is more
> standard  IMHO ( LONG_LONG_MAX is GNU libc, LLONG_MAX is C99 standard )
> The following patch makes this trivial switch.

As qemu is not compiled with -std=c99, LLONG_MAX is not guaranteed to be
defined (it is on recent systems, not on old ones). The best solution in
that case is probably to do at the begining of the file:

#ifndef LONG_LONG_MAX
#define LONG_LONG_MAX LLONG_MAX
#endif

Or applying your patch and doing the reverse.

Also please add a Signed-off-by: line.

> --- block-raw-posix.c.before    2010-01-07 22:40:37.000000000 +0100
> +++ block-raw-posix.c   2010-01-07 22:41:43.000000000 +0100
> @@ -782,7 +782,7 @@
>          if (size == 0)
>  #endif
>  #ifdef CONFIG_COCOA
> -        size = LONG_LONG_MAX;
> +        size = LLONG_MAX;
>  #else
>          size = lseek(fd, 0LL, SEEK_END);
>  #endif
> 
> 
>

Patch

--- block-raw-posix.c.before    2010-01-07 22:40:37.000000000 +0100
+++ block-raw-posix.c   2010-01-07 22:41:43.000000000 +0100
@@ -782,7 +782,7 @@ 
         if (size == 0)
 #endif
 #ifdef CONFIG_COCOA
-        size = LONG_LONG_MAX;
+        size = LLONG_MAX;
 #else
         size = lseek(fd, 0LL, SEEK_END);
 #endif