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 <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
PulkoMandy
2022-11-08 16:11:40 +00:00
committed by waddlesplash
parent cedd85556c
commit 32a71a00aa
+4 -4
View File
@@ -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