changeset 15960:85f5b7651b9a

xstrtoll: Fix compilation failure. * lib/xstrtol.c (ULLONG_MAX, LLONG_MAX, LLONG_MIN): New macros, taken from lib/strtol.c. * doc/posix-headers/limits.texi: Mention missing numerical limits on some platforms. Reported by Tom G. Christensen <tgc@jupiterrise.com>.
author Bruno Haible <bruno@clisp.org>
date Sat, 15 Oct 2011 17:06:24 +0200
parents a18c505b7981
children 27cc5b08d442
files ChangeLog doc/posix-headers/limits.texi lib/xstrtol.c
diffstat 3 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-10-15  Bruno Haible  <bruno@clisp.org>
+
+	xstrtoll: Fix compilation failure.
+	* lib/xstrtol.c (ULLONG_MAX, LLONG_MAX, LLONG_MIN): New macros, taken
+	from lib/strtol.c.
+	* doc/posix-headers/limits.texi: Mention missing numerical limits on
+	some platforms.
+	Reported by Tom G. Christensen <tgc@jupiterrise.com>.
+
 2011-10-15  Bruno Haible  <bruno@clisp.org>
 
 	vasnprintf: Optimize bit search operation.
--- a/doc/posix-headers/limits.texi
+++ b/doc/posix-headers/limits.texi
@@ -7,13 +7,24 @@
 
 Portability problems fixed by Gnulib:
 @itemize
-@item The @code{HOST_NAME_MAX} macro is not defined on some platforms:
+@item
+The @code{HOST_NAME_MAX} macro is not defined on some platforms:
 MacOS X 10.5, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, AIX 5.1, HP-UX 11,
 IRIX 6.5, OSF/1 5.1, Solaris 11 2010-11, Cygwin 1.5.x, mingw, MSVC 9, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
+@item
+The macros @code{LLONG_MIN}, @code{LLONG_MAX}, @code{ULLONG_MAX} are not
+defined on some platforms:
+AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1 with gcc.
+@item
+The macros @code{WORD_BIT}, @code{LONG_BIT} are not defined on some platforms:
+glibc 2.11 without @code{-D_GNU_SOURCE}, Cygwin, mingw, MSVC 9.
+@item
+The macro @code{SSIZE_MAX} is not defined on some platforms:
+MSVC 9.
 @end itemize
 
 For @code{PATH_MAX}, Gnulib provides a module @code{pathmax} with a header
--- a/lib/xstrtol.c
+++ b/lib/xstrtol.c
@@ -43,6 +43,19 @@
 
 #include "intprops.h"
 
+/* xstrtoll.c and xstrtoull.c, which include this file, require that
+   ULLONG_MAX, LLONG_MAX, LLONG_MIN are defined, but <limits.h> does not
+   define them on all platforms.  */
+#ifndef ULLONG_MAX
+# define ULLONG_MAX TYPE_MAXIMUM (unsigned long long)
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX TYPE_MAXIMUM (long long int)
+#endif
+#ifndef LLONG_MIN
+# define LLONG_MIN TYPE_MINIMUM (long long int)
+#endif
+
 static strtol_error
 bkm_scale (__strtol_t *x, int scale_factor)
 {