summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2019-12-22 09:59:49 +0100
committerBruno Haible <bruno@clisp.org>2019-12-22 10:00:28 +0100
commit1cf18f42fc1a47c17ba0073c1391a0f66fc4435e (patch)
tree1ed9a5bb7c97bfa6cff123676ccf08573ca03d06
parent5377e375dd6e933437bac066cd86ea54880f3f73 (diff)
downloadgnulib-1cf18f42fc1a47c17ba0073c1391a0f66fc4435e.tar.gz
strtoimax, strtoumax: Assume that the compiler supports 'long long'.
* lib/strtoimax.c: Assume HAVE_LONG_LONG_INT and HAVE_UNSIGNED_LONG_LONG_INT to be 1. * m4/strtoimax.m4 (gl_PREREQ_STRTOIMAX): Don't require AC_TYPE_LONG_LONG_INT. * m4/strtoumax.m4 (gl_PREREQ_STRTOUMAX): Don't require AC_TYPE_UNSIGNED_LONG_LONG_INT. * modules/strtoimax (Files): Remove longlong.m4. * modules/strtoumax (Files): Likewise.
-rw-r--r--ChangeLog10
-rw-r--r--lib/strtoimax.c22
-rw-r--r--m4/strtoimax.m43
-rw-r--r--m4/strtoumax.m43
-rw-r--r--modules/strtoimax1
-rw-r--r--modules/strtoumax1
6 files changed, 18 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index e295186332..d5b304bdb6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2019-12-22 Bruno Haible <bruno@clisp.org>
+ strtoimax, strtoumax: Assume that the compiler supports 'long long'.
+ * lib/strtoimax.c: Assume HAVE_LONG_LONG_INT and
+ HAVE_UNSIGNED_LONG_LONG_INT to be 1.
+ * m4/strtoimax.m4 (gl_PREREQ_STRTOIMAX): Don't require
+ AC_TYPE_LONG_LONG_INT.
+ * m4/strtoumax.m4 (gl_PREREQ_STRTOUMAX): Don't require
+ AC_TYPE_UNSIGNED_LONG_LONG_INT.
+ * modules/strtoimax (Files): Remove longlong.m4.
+ * modules/strtoumax (Files): Likewise.
+
xstrtoll: Assume that the compiler supports 'long long'.
* lib/xstrtol.h (xstrtoll, xstrtoull): Declare unconditionally.
* modules/xstrtoll (configure.ac): Don't invoke AC_TYPE_LONG_LONG_INT.
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 87b080c4f3..6c9cc63cbf 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -28,36 +28,30 @@
#include "verify.h"
#ifdef UNSIGNED
-# if HAVE_UNSIGNED_LONG_LONG_INT
-# ifndef HAVE_DECL_STRTOULL
+# ifndef HAVE_DECL_STRTOULL
"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOULL
+# endif
+# if !HAVE_DECL_STRTOULL
unsigned long long int strtoull (char const *, char **, int);
-# endif
# endif
#else
-# if HAVE_LONG_LONG_INT
-# ifndef HAVE_DECL_STRTOLL
+# ifndef HAVE_DECL_STRTOLL
"this configure-time declaration test was not run"
-# endif
-# if !HAVE_DECL_STRTOLL
+# endif
+# if !HAVE_DECL_STRTOLL
long long int strtoll (char const *, char **, int);
-# endif
# endif
#endif
#ifdef UNSIGNED
-# define Have_long_long HAVE_UNSIGNED_LONG_LONG_INT
# define Int uintmax_t
# define Strtoimax strtoumax
# define Strtol strtoul
# define Strtoll strtoull
# define Unsigned unsigned
#else
-# define Have_long_long HAVE_LONG_LONG_INT
# define Int intmax_t
# define Strtoimax strtoimax
# define Strtol strtol
@@ -68,15 +62,11 @@ long long int strtoll (char const *, char **, int);
Int
Strtoimax (char const *ptr, char **endptr, int base)
{
-#if Have_long_long
verify (sizeof (Int) == sizeof (Unsigned long int)
|| sizeof (Int) == sizeof (Unsigned long long int));
if (sizeof (Int) != sizeof (Unsigned long int))
return Strtoll (ptr, endptr, base);
-#else
- verify (sizeof (Int) == sizeof (Unsigned long int));
-#endif
return Strtol (ptr, endptr, base);
}
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
index 9632279a18..deb6f7f836 100644
--- a/m4/strtoimax.m4
+++ b/m4/strtoimax.m4
@@ -1,4 +1,4 @@
-# strtoimax.m4 serial 15
+# strtoimax.m4 serial 16
dnl Copyright (C) 2002-2004, 2006, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -85,5 +85,4 @@ int main ()
# Prerequisites of lib/strtoimax.c.
AC_DEFUN([gl_PREREQ_STRTOIMAX], [
AC_CHECK_DECLS([strtoll])
- AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
])
diff --git a/m4/strtoumax.m4 b/m4/strtoumax.m4
index 89b503f291..6bafe53813 100644
--- a/m4/strtoumax.m4
+++ b/m4/strtoumax.m4
@@ -1,4 +1,4 @@
-# strtoumax.m4 serial 12
+# strtoumax.m4 serial 13
dnl Copyright (C) 2002-2004, 2006, 2009-2019 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -24,5 +24,4 @@ AC_DEFUN([gl_FUNC_STRTOUMAX],
# Prerequisites of lib/strtoumax.c.
AC_DEFUN([gl_PREREQ_STRTOUMAX], [
AC_CHECK_DECLS([strtoull])
- AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
])
diff --git a/modules/strtoimax b/modules/strtoimax
index 36a96de4b5..1cdd92579e 100644
--- a/modules/strtoimax
+++ b/modules/strtoimax
@@ -4,7 +4,6 @@ strtoimax() function: convert string to 'intmax_t'.
Files:
lib/strtoimax.c
m4/strtoimax.m4
-m4/longlong.m4
Depends-on:
inttypes-incomplete
diff --git a/modules/strtoumax b/modules/strtoumax
index 725f523c25..201332ca09 100644
--- a/modules/strtoumax
+++ b/modules/strtoumax
@@ -4,7 +4,6 @@ strtoumax() function: convert string to 'uintmax_t'.
Files:
lib/strtoimax.c
lib/strtoumax.c
-m4/longlong.m4
m4/strtoumax.m4
Depends-on: