From 87d548c5201a7edcc54fc0cbd54cb1585ebac8d6 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Fri, 26 Nov 2021 23:08:32 +0100 Subject: [PATCH] LibC: Make SIZE_MAX be understood by the preprocessor POSIX mandates that the macros contained in `stdint.h` be suitable for use by the C preprocessor. If we write `((size_t)-1)`, the C preprocessor will just skip the cast and treat the value as `-1`. This means that we end up taking the wrong branch in an `#if` directive like `#if SIZE_MAX > UINT32_MAX`. This fixes building the LLVM port on i686. --- Userland/Libraries/LibC/bits/stdint.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibC/bits/stdint.h b/Userland/Libraries/LibC/bits/stdint.h index 6b90e51af9..108f0212af 100644 --- a/Userland/Libraries/LibC/bits/stdint.h +++ b/Userland/Libraries/LibC/bits/stdint.h @@ -132,7 +132,7 @@ typedef __INTMAX_TYPE__ intmax_t; #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX -#define SIZE_MAX ((size_t)-1) +#define SIZE_MAX __SIZE_MAX__ #define PTRDIFF_MAX __PTRDIFF_MAX__ #define PTRDIFF_MIN (-__PTRDIFF_MAX__ - 1)