]> Savannah Git Hosting - gnulib.git/commitdiff
stdint: port SIZE_MAX to glibc s390
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Oct 2016 18:16:40 +0000 (11:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 13 Oct 2016 18:17:13 +0000 (11:17 -0700)
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.

ChangeLog
doc/posix-headers/stdint.texi
m4/stdint.m4

index 070e498d55466cf511305e7c4b207d5cc628e06d..89ba80f0a0248ed529608772d4c2e94014b31076 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+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
index 2cc083ca8918c40b96bd6438a57e613d5719824d..d5ca3c21d87909423be8378590a0f52f5f90c8c9 100644 (file)
@@ -34,6 +34,10 @@ constant macros such as @code{INTMAX_C}, and one must define
 @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
@@ -48,10 +52,6 @@ so public header files should avoid these types.
 @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}.
index fa6f103a63bb09400a5f8fd94e754c6f33fd31c6..05b6ab7846b4e5cbadc5b056871af6db3c75e95b 100644 (file)
@@ -1,4 +1,4 @@
-# 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,
@@ -154,6 +154,15 @@ uintptr_t h = UINTPTR_MAX;
 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)))