From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2153) id D52ED3858C2D; Tue, 13 Feb 2024 09:33:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D52ED3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707816833; bh=nY6D/Re3ScJX/S9A/2hGl+aBHURd6ycToi1bRA4AgrU=; h=From:To:Subject:Date:From; b=EVH+mhV3RZzV6lORKdGMkBwIgtjbku6nn0hFBaD0rDAy7yeLw0dkbMrKKHLo4S+96 jR9xEZ93JRqeYyexjVLnyatU0dUjf1fPW900/yoe/3Ve0ilE6pE5NYYuPGIw9+td4j vQy4mW5oaX72hXxEns2BDZod+cXFwYtYQK+cugY4= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jakub Jelinek To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8948] hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t X-Act-Checkin: gcc X-Git-Author: Jakub Jelinek X-Git-Refname: refs/heads/master X-Git-Oldrev: 6caec7d9ec37e60e718a12934c85bac9c12757ac X-Git-Newrev: 21de3391e4cecfef6ad1b60772cb55616c1bf7bd Message-Id: <20240213093353.D52ED3858C2D@sourceware.org> Date: Tue, 13 Feb 2024 09:33:53 +0000 (GMT) List-Id: https://gcc.gnu.org/g:21de3391e4cecfef6ad1b60772cb55616c1bf7bd commit r14-8948-g21de3391e4cecfef6ad1b60772cb55616c1bf7bd Author: Jakub Jelinek Date: Tue Feb 13 10:32:01 2024 +0100 hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t Using unsigned long long int for fmt_size_t and "ll" for GCC_PRISZ as broke the gengtype on i686-linux before the libiberty fix is certainly unexpected. size_t is there unsigned int, so expected fmt_size_t is unsigned int (or some other 32-bit type). The problem was that I was comparing SIZE_MAX against signed maxima, but SIZE_MAX is unsigned maximum. 2024-02-13 Jakub Jelinek * hwint.h (GCC_PRISZ, fmt_size_t): Fix preprocessor conditions, instead of comparing SIZE_MAX against INT_MAX and LONG_MAX compare it against UINT_MAX and ULONG_MAX. Diff: --- gcc/hwint.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/hwint.h b/gcc/hwint.h index e070e7d8dc22..25a94bedef1c 100644 --- a/gcc/hwint.h +++ b/gcc/hwint.h @@ -120,10 +120,10 @@ typedef HOST_WIDE_INT __gcc_host_wide_int__; So, instead of doing fprintf ("%zu\n", sizeof (x) * y); use fprintf (HOST_SIZE_T_PRINT_UNSIGNED "\n", (fmt_size_t) (sizeof (x) * y)); */ -#if SIZE_MAX <= INT_MAX +#if SIZE_MAX <= UINT_MAX # define GCC_PRISZ "" # define fmt_size_t unsigned int -#elif SIZE_MAX <= LONG_MAX +#elif SIZE_MAX <= ULONG_MAX # define GCC_PRISZ HOST_LONG_FORMAT # define fmt_size_t unsigned long int #else