summaryrefslogtreecommitdiff
path: root/lib/stdlib.in.h
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2021-04-02 20:46:15 +0200
committerBruno Haible <bruno@clisp.org>2021-04-02 20:46:15 +0200
commitea1816fd6d334b4bfd8368a63d9bda3cad1c9b0d (patch)
tree68ad3316295d89b4d4e54ba1f6dedabf2f258b1a /lib/stdlib.in.h
parent705c23696fcaf5bd9d4f0aaecd106b4a2c1417b2 (diff)
downloadgnulib-ea1816fd6d334b4bfd8368a63d9bda3cad1c9b0d.tar.gz
strtoll: Work around a bug on native Windows and Minix.
* lib/stdlib.in.h (strtoll): Override if REPLACE_STRTOLL is 1. * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_STRTOLL. * m4/strtoll.m4 (gl_FUNC_STRTOLL): Test whether strtoll works. Set REPLACE_STRTOLL. * modules/stdlib (Makefile.am): Substitute REPLACE_STRTOLL. * modules/strtoll (configure.ac): Test REPLACE_STRTOLL. * tests/test-strtoll.c (main): Add tests of hexadecimal integer syntax. * doc/posix-functions/strtoll.texi: Mention the bug.
Diffstat (limited to 'lib/stdlib.in.h')
-rw-r--r--lib/stdlib.in.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index e2c461b59a..c07fd1f5d7 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1252,15 +1252,29 @@ _GL_WARN_ON_USE (strtol, "strtol is unportable - "
stored in *ENDPTR.
Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set
to ERANGE. */
-# if !@HAVE_STRTOLL@
+# if @REPLACE_STRTOLL@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# define strtoll rpl_strtoll
+# endif
+# define GNULIB_defined_strtoll_function 1
+_GL_FUNCDECL_RPL (strtoll, long long,
+ (const char *restrict string, char **restrict endptr,
+ int base)
+ _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtoll, long long,
+ (const char *restrict string, char **restrict endptr,
+ int base));
+# else
+# if !@HAVE_STRTOLL@
_GL_FUNCDECL_SYS (strtoll, long long,
(const char *restrict string, char **restrict endptr,
int base)
_GL_ARG_NONNULL ((1)));
-# endif
+# endif
_GL_CXXALIAS_SYS (strtoll, long long,
(const char *restrict string, char **restrict endptr,
int base));
+# endif
_GL_CXXALIASWARN (strtoll);
#elif defined GNULIB_POSIXCHECK
# undef strtoll