Received: from eggs.gnu.org ([2001:4830:134:3::10]:47835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bu1QN-0008Ka-Oz for qemu-devel@nongnu.org; Tue, 11 Oct 2016 14:05:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bu1QM-00079f-Od for qemu-devel@nongnu.org; Tue, 11 Oct 2016 14:05:11 -0400 From: Markus Armbruster References: <1476200784-17210-1-git-send-email-eblake@redhat.com> Date: Tue, 11 Oct 2016 20:05:03 +0200 In-Reply-To: <1476200784-17210-1-git-send-email-eblake@redhat.com> (Eric Blake's message of "Tue, 11 Oct 2016 10:46:23 -0500") Message-ID: <87mvia7ods.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v5] build: Work around SIZE_MAX bug in OSX headers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, kwolf@redhat.com, peter.maydell@linaro.org, ashijeetacharya@gmail.com, qemu-block@nongnu.org Eric Blake writes: > 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 > time. > > 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 Reviewed-by: Markus Armbruster