[PATCH] D31856: Headers: Make the type of SIZE_MAX the same as size_t
Richard Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 20 16:26:46 PDT 2017
rsmith requested changes to this revision.
rsmith added a comment.
This revision now requires changes to proceed.
This is sadly not a correct change. The relevant requirements (C11 7.20.3/2) on these macros are:
> Each instance of these macros shall be replaced by a constant expression suitable for use in `#if` preprocessing directives, and this expression shall have the same type as would an expression that is an object of the corresponding type converted according to the integer promotions.
The "suitable for use in `#if`" requirement means that you cannot use a cast, and must instead use a suitable numeric suffix.
Can we instead use `__SIZE_MAX__`? (And likewise for `ptrdiff_t` etc.)
================
Comment at: clang/test/Preprocessor/stdint.c:1411
// JOIN:PTRDIFF_MAX_ 2147483647
-// JOIN:SIZE_MAX_ 4294967295U
+// JOIN:SIZE_MAX_ ((unsigned a)4294967295U)
// JOIN:INTMAX_MIN_ (-9223372036854775807LL -1)
----------------
Do we really define `__SIZE_TYPE__` to `unsigned a` for some target?
https://reviews.llvm.org/D31856
More information about the cfe-commits
mailing list