Received: from eggs.gnu.org ([2001:4830:134:3::10]:50813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1btiE3-0004l4-41 for qemu-devel@nongnu.org; Mon, 10 Oct 2016 17:35:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1btiE0-0004bx-UW for qemu-devel@nongnu.org; Mon, 10 Oct 2016 17:35:10 -0400 References: <1476124035-11455-1-git-send-email-eblake@redhat.com> From: Eric Blake Message-ID: <4efc483c-ada1-83c7-5f21-2031cd26937c@redhat.com> Date: Mon, 10 Oct 2016 16:35:00 -0500 MIME-Version: 1.0 In-Reply-To: <1476124035-11455-1-git-send-email-eblake@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="lbjqXSB4jp7ka2qpS6pheUeqj20oVOlwH" Subject: Re: [Qemu-devel] [PATCH v3] build: Work around SIZE_MAX bug in OSX headers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, ashijeetacharya@gmail.com, armbru@redhat.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --lbjqXSB4jp7ka2qpS6pheUeqj20oVOlwH From: Eric Blake To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, peter.maydell@linaro.org, ashijeetacharya@gmail.com, armbru@redhat.com, qemu-block@nongnu.org Message-ID: <4efc483c-ada1-83c7-5f21-2031cd26937c@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3] build: Work around SIZE_MAX bug in OSX headers References: <1476124035-11455-1-git-send-email-eblake@redhat.com> In-Reply-To: <1476124035-11455-1-git-send-email-eblake@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > 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. >=20 > Signed-off-by: Eric Blake >=20 > +/* Mac OSX has a 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=3Dundef doesn't like this one. v4 coming up --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --lbjqXSB4jp7ka2qpS6pheUeqj20oVOlwH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX/AmEAAoJEKeha0olJ0NqlKsH/2zPm3aAZ6a1/Lp8P67seBMN zElSeL5KL+F3bFyjZES4+DNcnga8cTpItKMIJOkPyNSlnBBjxY4q3JpjECx4Wl5f 6006Z/WjR0lC7L3iULHTKck69fK4H+1bfFhioDg3/czkzcT1tY9dKxuPguUDr4zf Xfghcv5kF3Ua7swTW3vbsTp5xgeXgVZqmTTgTrpTARiFBTkyLequzmtyJbuEL1AA HhgLcUzhN6bBv2KrmT6D50HLo56EBS/ObtY8JnVoV1JzOBDjj9tKbSCcB2jOsje3 Xjuy0cKyInyL6mYUKD/vHjolQ3eRzCKJMqCzk3Z9E9pbbd/I4dl+2lDERM9UsUU= =bKlS -----END PGP SIGNATURE----- --lbjqXSB4jp7ka2qpS6pheUeqj20oVOlwH--