From 32a71a00aab29e272bd85e29061e1cf6431cdc77 Mon Sep 17 00:00:00 2001 From: PulkoMandy Date: Mon, 7 Nov 2022 18:18:40 +0100 Subject: [PATCH] stdint.h: fix definition of UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C C99 chapter 7.18.2, Limits of specified-width integer types: "This expression shall have the same type as would an expression that is an object of the corresponding type according to the integer promotions." C99 chapter 6.3.1.1: "If an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions." Therefore, UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C should be signed. This prevents building WebKit with -Werror. Change-Id: Ib2a2c15acc2c761cccf8caa016c7ff163e3fdc0d Reviewed-on: https://review.haiku-os.org/c/haiku/+/5806 Tested-by: Commit checker robot Reviewed-by: waddlesplash --- headers/posix/stdint.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/headers/posix/stdint.h b/headers/posix/stdint.h index 7bb69998de..45832ce29c 100644 --- a/headers/posix/stdint.h +++ b/headers/posix/stdint.h @@ -59,11 +59,11 @@ typedef uint64_t uintmax_t; /* Limits of exact-width integer types */ #define INT8_MIN (-128) #define INT8_MAX (127) -#define UINT8_MAX (255U) +#define UINT8_MAX (255) #define INT16_MIN (-32768) #define INT16_MAX (32767) -#define UINT16_MAX (65535U) +#define UINT16_MAX (65535) #define INT32_MAX (2147483647) #define INT32_MIN (-INT32_MAX-1) @@ -140,8 +140,8 @@ typedef uint64_t uintmax_t; #define INT16_C(value) value #define INT32_C(value) value -#define UINT8_C(value) value ## U -#define UINT16_C(value) value ## U +#define UINT8_C(value) value +#define UINT16_C(value) value #define UINT32_C(value) value ## U #if defined(__SIZEOF_LONG__) && __SIZEOF_LONG__ > 4