+2016-10-13 Paul Eggert <eggert@cs.ucla.edu>
+
+ stdint: port SIZE_MAX to glibc s390
+ Problem reported by Eric Blake in:
+ http://lists.gnu.org/archive/html/bug-gnulib/2016-10/msg00031.html
+ * doc/posix-headers/stdint.texi (stdint.h): Document the fix.
+ * m4/stdint.m4 (gl_STDINT_H): Check that SIZE_MAX has the
+ correct type, if possible.
+
2016-10-13 Daniel Richard G. <skunk@iSKUNK.ORG>
getprogname: port to IBM z/OS
@code{__STDC_LIMIT_MACROS} to make visible the definitions of limit
macros such as @code{INTMAX_MAX}.
@item
+The macro @code{SIZE_MAX} has the wrong type,
+albeit with the correct value:
+32-bit glibc 2.24 (on s390 architecture), Mac OS X 10.7.
+@item
Macros like @code{INTMAX_WIDTH} are not defined on some platforms:
glibc 2.24, many others.
@end itemize
@item
Macros are used instead of typedefs.
@item
-The macro @code{SIZE_MAX} has the wrong type,
-albeit with the correct value:
-32-bit glibc 2.24 (on s390 architecture), Mac OS X 10.7.
-@item
Some C preprocessors mishandle constants that do not fit in @code{long int}.
For example, as of 2007, Sun C mishandles @code{#if LLONG_MIN < 0} on
a platform with 32-bit @code{long int} and 64-bit @code{long long int}.
-# stdint.m4 serial 47
+# stdint.m4 serial 48
dnl Copyright (C) 2001-2016 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
intmax_t i = INTMAX_MAX;
uintmax_t j = UINTMAX_MAX;
+/* Check that SIZE_MAX has the correct type, if possible. */
+#if 201112 <= __STDC_VERSION__
+int k = _Generic (SIZE_MAX, size_t: 0);
+#elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
+ || (0x5110 <= __SUNPRO_C && !__STDC__))
+extern size_t k;
+extern __typeof__ (SIZE_MAX) k;
+#endif
+
#include <limits.h> /* for CHAR_BIT */
#define TYPE_MINIMUM(t) \
((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))