# HG changeset patch # User Bruno Haible # Date 1318691184 -7200 # Node ID 85f5b7651b9a8ff72ff3c64ceeea25828ce8dfa2 # Parent a18c505b79816b625a78a4b6ac1dd2b3aca8f3c6 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 . diff --git a/ChangeLog b/ChangeLog --- 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 --- 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 diff --git a/lib/xstrtol.c b/lib/xstrtol.c --- 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) {