>From 1cf18f42fc1a47c17ba0073c1391a0f66fc4435e Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 22 Dec 2019 09:59:49 +0100 Subject: [PATCH 08/15] 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. --- ChangeLog | 10 ++++++++++ lib/strtoimax.c | 22 ++++++---------------- m4/strtoimax.m4 | 3 +-- m4/strtoumax.m4 | 3 +-- modules/strtoimax | 1 - modules/strtoumax | 1 - 6 files changed, 18 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index e295186..d5b304b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,15 @@ 2019-12-22 Bruno Haible + 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 87b080c..6c9cc63 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 9632279..deb6f7f 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 89b503f..6bafe53 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 36a96de..1cdd925 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 725f523..201332c 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: -- 2.7.4