Skip to content

Commit 21de339

Browse files
committed
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 <[email protected]> * 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.
1 parent 6caec7d commit 21de339

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gcc/hwint.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ typedef HOST_WIDE_INT __gcc_host_wide_int__;
120120
So, instead of doing fprintf ("%zu\n", sizeof (x) * y); use
121121
fprintf (HOST_SIZE_T_PRINT_UNSIGNED "\n",
122122
(fmt_size_t) (sizeof (x) * y)); */
123-
#if SIZE_MAX <= INT_MAX
123+
#if SIZE_MAX <= UINT_MAX
124124
# define GCC_PRISZ ""
125125
# define fmt_size_t unsigned int
126-
#elif SIZE_MAX <= LONG_MAX
126+
#elif SIZE_MAX <= ULONG_MAX
127127
# define GCC_PRISZ HOST_LONG_FORMAT
128128
# define fmt_size_t unsigned long int
129129
#else

0 commit comments

Comments
 (0)