Commit 1cf18f42 authored by Bruno Haible's avatar Bruno Haible
Browse files

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.
parent 5377e375
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.
......@@ -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);
}
# 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])
])
# 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])
])
......@@ -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
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment