On 10/10/2016 01:27 PM, Eric Blake wrote: > 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), let the compiler get the right > type for us by virtue of integer promotion - if we later need it > during the preprocessor, the build will break on Mac until we > improve our replacement. > > 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 <ebl...@redhat.com> >
> +/* Mac OSX has a <stdint.h> bug that incorrectly defines SIZE_MAX with > + * the wrong type. Our replacement isn't usable in preprocessor > + * expressions, but it is sufficient for our needs. */ > +#if HAVE_BROKEN_SIZE_MAX Whoops, -Werror=undef doesn't like this one. v4 coming up -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature