Add strtoull() declaration to <stdlib.h>.
authorBruno Haible <bruno@clisp.org>
Sun, 19 Oct 2008 16:50:15 +0000 (18:50 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 19 Oct 2008 16:50:15 +0000 (18:50 +0200)
ChangeLog
lib/stdlib.in.h
m4/stdlib_h.m4
m4/strtoull.m4
modules/stdlib
modules/strtoull

index 742c0c4ad6b67270f2ec129e47ad40399f1beeba..f448b43f9a3d1f4e97e776535163b07f705a6501 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-10-19  Bruno Haible  <bruno@clisp.org>
+
+       Add strtoull() declaration to <stdlib.h>.
+       * lib/stdlib.in.h (strtoull): New declaration.
+       * m4/strtoull.m4 (gl_FUNC_STRTOLL): Require gl_STDLIB_H_DEFAULTS.
+       Set HAVE_STRTOULL.
+       * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize GNULIB_STRTOULL,
+       HAVE_STRTOULL.
+       * modules/strtoull (Depends-on): Add stdlib.
+       (configure.ac): Invoke gl_STDLIB_MODULE_INDICATOR.
+       * modules/stdlib (Makefile.am): Substitute GNULIB_STRTOULL,
+       HAVE_STRTOULL.
+
 2008-10-19  Bruno Haible  <bruno@clisp.org>
 
        Add strtoll() declaration to <stdlib.h>.
index cf8cf778297fad72cfd419a0c860c11e92c98bc3..5e04b1e3045aa17f3c25b82248c6f68050fafa87 100644 (file)
@@ -265,8 +265,8 @@ extern double strtod (const char *str, char **endp);
    "0x").
    If ENDPTR is not NULL, the address of the first byte after the integer is
    stored in *ENDPTR.
-   Upon overflow or underflow, the return value is LLONG_MAX or LLONG_MIN,
-   respectively, and errno is set to ERANGE.  */
+   Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
+   to ERANGE.  */
 extern long long strtoll (const char *string, char **endptr, int base);
 # endif
 #elif defined GNULIB_POSIXCHECK
@@ -278,6 +278,27 @@ extern long long strtoll (const char *string, char **endptr, int base);
 #endif
 
 
+#if @GNULIB_STRTOULL@
+# if !@HAVE_STRTOULL@
+/* Parse an unsigned integer whose textual representation starts at STRING.
+   The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
+   it may be decimal or octal (with prefix "0") or hexadecimal (with prefix
+   "0x").
+   If ENDPTR is not NULL, the address of the first byte after the integer is
+   stored in *ENDPTR.
+   Upon overflow, the return value is ULLONG_MAX, and errno is set to
+   ERANGE.  */
+extern unsigned long long strtoull (const char *string, char **endptr, int base);
+# endif
+#elif defined GNULIB_POSIXCHECK
+# undef strtoull
+# define strtoull(s,e,b) \
+    (GL_LINK_WARNING ("strtoull is unportable - " \
+                      "use gnulib module strtoull for portability"), \
+     strtoull (s, e, b))
+#endif
+
+
 #ifdef __cplusplus
 }
 #endif
index b1f2c0e95cd06cdd6e611fbf55d88848a4160abc..46078fe73011915f3a1959b48fe77d1feadb92a3 100644 (file)
@@ -1,4 +1,4 @@
-# stdlib_h.m4 serial 9
+# stdlib_h.m4 serial 10
 dnl Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -31,6 +31,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
   GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
+  GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
   GNULIB_UNSETENV=0;      AC_SUBST([GNULIB_UNSETENV])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_CALLOC_POSIX=1;    AC_SUBST([HAVE_CALLOC_POSIX])
@@ -42,6 +43,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_SETENV=1;          AC_SUBST([HAVE_SETENV])
   HAVE_STRTOD=1;          AC_SUBST([HAVE_STRTOD])
   HAVE_STRTOLL=1;         AC_SUBST([HAVE_STRTOLL])
+  HAVE_STRTOULL=1;        AC_SUBST([HAVE_STRTOULL])
   HAVE_SYS_LOADAVG_H=0;   AC_SUBST([HAVE_SYS_LOADAVG_H])
   HAVE_UNSETENV=1;        AC_SUBST([HAVE_UNSETENV])
   HAVE_DECL_GETLOADAVG=1; AC_SUBST([HAVE_DECL_GETLOADAVG])
index fcec3de2ac4a33b93597d54959031e06592b8eaa..809d0bcbda40e46509515784d605d52ef986f4e5 100644 (file)
@@ -1,17 +1,19 @@
-# strtoull.m4 serial 4
-dnl Copyright (C) 2002, 2004, 2006 Free Software Foundation, Inc.
+# strtoull.m4 serial 5
+dnl Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 AC_DEFUN([gl_FUNC_STRTOULL],
 [
+  AC_REQUIRE([gl_STDLIB_H_DEFAULTS])
   dnl We don't need (and can't compile) the replacement strtoull
   dnl unless the type 'unsigned long long int' exists.
   AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
   if test "$ac_cv_type_unsigned_long_long_int" = yes; then
     AC_REPLACE_FUNCS(strtoull)
     if test $ac_cv_func_strtoull = no; then
+      HAVE_STRTOULL=0
       gl_PREREQ_STRTOULL
     fi
   fi
index 157af2120d756605e31f4b4ea67a83bc147bfa8a..169d883bff9217b133e25f75b6a9af7d5108df5f 100644 (file)
@@ -36,6 +36,7 @@ stdlib.h: stdlib.in.h
              -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \
              -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \
              -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \
+             -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \
              -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \
              -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
@@ -46,6 +47,7 @@ stdlib.h: stdlib.in.h
              -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
              -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
+             -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
              -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \
              -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
index 9cf4d7f497388b5fbcf1e39aa0b60d0889fce79c..0347b7ead2af12b1f54702e273e8b61e30b02dac 100644 (file)
@@ -7,10 +7,12 @@ m4/longlong.m4
 m4/strtoull.m4
 
 Depends-on:
+unistd
 strtoul
 
 configure.ac:
 gl_FUNC_STRTOULL
+gl_STDLIB_MODULE_INDICATOR([strtoull])
 
 Makefile.am: