From 0a19a162755da4ef297bcacd62cf5243c76324ed Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 15 Oct 2011 17:06:24 +0200 Subject: [PATCH] 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 . --- ChangeLog | 9 +++++++++ doc/posix-headers/limits.texi | 13 ++++++++++++- lib/xstrtol.c | 13 +++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index ee724cd329..28133a6c03 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-10-15 Bruno Haible + + 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 . + 2011-10-15 Bruno Haible vasnprintf: Optimize bit search operation. diff --git a/doc/posix-headers/limits.texi b/doc/posix-headers/limits.texi index bec8310ec0..c7bc7ba72d 100644 --- a/doc/posix-headers/limits.texi +++ b/doc/posix-headers/limits.texi @@ -7,13 +7,24 @@ Gnulib module: gethostname 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 diff --git a/lib/xstrtol.c b/lib/xstrtol.c index 97ebd9078b..b1fdd4938d 100644 --- 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 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) { -- 2.39.5