diff options
author | Bruno Haible <bruno@clisp.org> | 2018-09-06 14:41:00 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-09-06 14:41:00 +0200 |
commit | 05e49b15838f5bce440ffc87693f6fc670614ba0 (patch) | |
tree | 73226d0c0c6dd0b9ae88d26dd0879c02221c8366 | |
parent | e6ec31bf96b3fc64aee3a265765546a83a403562 (diff) | |
download | gnulib-05e49b15838f5bce440ffc87693f6fc670614ba0.tar.gz |
strtoll, strtoull: Rely on limits-h module.
* lib/strtol.c (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove macros.
(ULLONG_MAX, LLONG_MAX, LLONG_MIN): Remove fallback definitions.
* modules/strtoll (Depends-on): Add limits-h.
* modules/strtoull (Depends-on): Likewise.
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/strtol.c | 29 | ||||
-rw-r--r-- | modules/strtoll | 1 | ||||
-rw-r--r-- | modules/strtoull | 1 |
4 files changed, 10 insertions, 29 deletions
@@ -1,5 +1,13 @@ 2018-09-06 Bruno Haible <bruno@clisp.org> + strtoll, strtoull: Rely on limits-h module. + * lib/strtol.c (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM): Remove macros. + (ULLONG_MAX, LLONG_MAX, LLONG_MIN): Remove fallback definitions. + * modules/strtoll (Depends-on): Add limits-h. + * modules/strtoull (Depends-on): Likewise. + +2018-09-06 Bruno Haible <bruno@clisp.org> + intprops tests: Fix compilation error with pre-C99 compiler. * tests/test-intprops.c (verify_stmt): New macro. (VERIFY, main): Use it. diff --git a/lib/strtol.c b/lib/strtol.c index 55871b4c78..f6f5c3268d 100644 --- a/lib/strtol.c +++ b/lib/strtol.c @@ -117,35 +117,6 @@ # define STRTOL_LONG_MIN LLONG_MIN # define STRTOL_LONG_MAX LLONG_MAX # define STRTOL_ULONG_MAX ULLONG_MAX - -/* The extra casts in the following macros work around compiler bugs, - e.g., in Cray C 5.0.3.0. */ - -/* True if the arithmetic type T is signed. */ -# define TYPE_SIGNED(t) (! ((t) 0 < (t) -1)) - -/* Minimum and maximum values for integer types. - These macros have undefined behavior for signed types that either - have padding bits or do not use two's complement. If this is a - problem for you, please let us know how to fix it for your host. */ - -/* The maximum and minimum values for the integer type T. */ -# define TYPE_MINIMUM(t) ((t) ~ TYPE_MAXIMUM (t)) -# define TYPE_MAXIMUM(t) \ - ((t) (! TYPE_SIGNED (t) \ - ? (t) -1 \ - : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1))) - -# ifndef ULLONG_MAX -# define ULLONG_MAX TYPE_MAXIMUM (unsigned long long) -# endif -# ifndef LLONG_MAX -# define LLONG_MAX TYPE_MAXIMUM (long long int) -# endif -# ifndef LLONG_MIN -# define LLONG_MIN TYPE_MINIMUM (long long int) -# endif - # if __GNUC__ == 2 && __GNUC_MINOR__ < 7 /* Work around gcc bug with using this constant. */ static const unsigned long long int maxquad = ULLONG_MAX; diff --git a/modules/strtoll b/modules/strtoll index 5501fdac3b..082d7f4ee5 100644 --- a/modules/strtoll +++ b/modules/strtoll @@ -8,6 +8,7 @@ m4/longlong.m4 m4/strtoll.m4 Depends-on: +limits-h stdlib configure.ac: diff --git a/modules/strtoull b/modules/strtoull index 6bb66fea22..7f94bcab61 100644 --- a/modules/strtoull +++ b/modules/strtoull @@ -9,6 +9,7 @@ m4/longlong.m4 m4/strtoull.m4 Depends-on: +limits-h stdlib configure.ac: |