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.
This commit is contained in:
Daniel Bertalan 2021-11-26 23:08:32 +01:00 committed by Brian Gianforcaro
parent 23adb7449f
commit 87d548c520
Notes: sideshowbarker 2024-07-18 02:13:10 +09:00

View file

@ -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)