[Top][All Lists]

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

[Qemu-commits] [qemu/qemu] 6b39b0: build: Work around SIZE_MAX bug in OS

From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 6b39b0: build: Work around SIZE_MAX bug in OSX headers
Date: Wed, 12 Oct 2016 03:00:02 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 6b39b06339ee59559b31f860d4af635b046322df
  Author: Eric Blake <address@hidden>
  Date:   2016-10-11 (Tue, 11 Oct 2016)

  Changed paths:
    M configure
    M include/qemu/osdep.h

  Log Message:
  build: Work around SIZE_MAX bug in OSX headers

C99 requires SIZE_MAX to be declared with the same type as the
integral promotion of size_t, but OSX mistakenly defines it as
an 'unsigned long long' expression even though size_t is only
'unsigned long'.  Rather than futzing around with whether size_t
is 32- or 64-bits wide (which would be needed if we cared about
using SIZE_T in a #if expression), just hard-code it with a cast.
This is not a strict C99-compliant definition, because it doesn't
work in the preprocessor, but if we later need that, the build
will break on Mac to inform us to improve our replacement at that

See also https://patchwork.ozlabs.org/patch/542327/ for an
instance where the wrong type trips us up if we don't fix it
for good in osdep.h.

Some versions of glibc make a similar mistake with SSIZE_MAX; the
goal is that the approach of this patch could be copied to work
around that problem if it ever becomes important to us.

Signed-off-by: Eric Blake <address@hidden>
Reviewed-by: Markus Armbruster <address@hidden>
Message-id: address@hidden
Reviewed-by: John Arbuckle <address@hidden>
Tested-by: Peter Maydell <address@hidden>
Signed-off-by: Peter Maydell <address@hidden>

reply via email to

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