aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-02-13 10:32:01 +0100
committerJakub Jelinek <jakub@redhat.com>2024-02-13 10:32:01 +0100
commit21de3391e4cecfef6ad1b60772cb55616c1bf7bd (patch)
treebab267e9f1c64f24180425f2aea4de96a1877d07
parent6caec7d9ec37e60e718a12934c85bac9c12757ac (diff)
downloadgcc-21de3391e4cecfef6ad1b60772cb55616c1bf7bd.zip
gcc-21de3391e4cecfef6ad1b60772cb55616c1bf7bd.tar.gz
gcc-21de3391e4cecfef6ad1b60772cb55616c1bf7bd.tar.bz2
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.
-rw-r--r--gcc/hwint.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/hwint.h b/gcc/hwint.h
index e070e7d..25a94be 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