public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8948] hwint: Fix up preprocessor conditions for GCC_PRISZ/fmt_size_t
Date: Tue, 13 Feb 2024 09:33:53 +0000 (GMT)	[thread overview]
Message-ID: <20240213093353.D52ED3858C2D@sourceware.org> (raw)

https://gcc.gnu.org/g:21de3391e4cecfef6ad1b60772cb55616c1bf7bd

commit r14-8948-g21de3391e4cecfef6ad1b60772cb55616c1bf7bd
Author: Jakub Jelinek <jakub@redhat.com>
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  <jakub@redhat.com>
    
            * 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

                 reply	other threads:[~2024-02-13  9:33 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240213093353.D52ED3858C2D@sourceware.org \
    --to=jakub@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).