diff options
author | Richard Henderson <rth@cygnus.com> | 1998-03-18 01:55:53 -0800 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 1998-03-18 01:55:53 -0800 |
commit | cbe3672526c7686edca6e3c5e81a6bb9369f36e0 (patch) | |
tree | 9865836d8f1059cd0102d063058ea0f8139fcf6a /gcc/rtl.c | |
parent | 80564603542ce9011d69bd4a8034c9839626643e (diff) | |
download | gcc-cbe3672526c7686edca6e3c5e81a6bb9369f36e0.zip gcc-cbe3672526c7686edca6e3c5e81a6bb9369f36e0.tar.gz gcc-cbe3672526c7686edca6e3c5e81a6bb9369f36e0.tar.bz2 |
rtl.c (read_rtx): Fall back on homebrew atoll if HOST_WIDE_INT is large...
* rtl.c (read_rtx): Fall back on homebrew atoll if HOST_WIDE_INT
is large, and the system doesn't provide atoll or atoq.
(atoll): New.
* alpha/xm-vms.h (HAVE_ATOLL): Define.
Reported by Klaus Kaempf <kkaempf@progis.de>.
From-SVN: r18657
Diffstat (limited to 'gcc/rtl.c')
-rw-r--r-- | gcc/rtl.c | 43 |
1 files changed, 40 insertions, 3 deletions
@@ -558,6 +558,43 @@ read_name (str, infile) *p = 0; } +/* Provide a version of a function to read a long long if the system does + not provide one. */ +#if HOST_BITS_PER_WIDE_INT > HOST_BITS_PER_LONG && !defined(HAVE_ATOLL) && !defined(HAVE_ATOQ) +HOST_WIDE_INT +atoll(p) + const char *p; +{ + int neg = 0; + HOST_WIDE_INT tmp_wide; + + while (isspace(*p)) + p++; + if (*p == '-') + neg = 1, p++; + else if (*p == '+') + p++; + + tmp_wide = 0; + while (isdigit(*p)) + { + HOST_WIDE_INT new_wide = tmp_wide*10 + (*p - '0'); + if (new_wide < tmp_wide) + { + /* Return INT_MAX equiv on overflow. */ + tmp_wide = (~(unsigned HOST_WIDE_INT)0) >> 1; + break; + } + tmp_wide = new_wide; + p++; + } + + if (neg) + tmp_wide = -tmp_wide; + return tmp_wide; +} +#endif + /* Read an rtx in printed representation from INFILE and return an actual rtx in core constructed accordingly. read_rtx is not used in the compiler proper, but rather in @@ -768,15 +805,15 @@ read_rtx (infile) #if HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG tmp_wide = atol (tmp_char); #else -#ifdef HAVE_ATOLL + /* Prefer atoll over atoq, since the former is in the ISO C9X draft. + But prefer not to use our hand-rolled function above either. */ +#if defined(HAVE_ATOLL) || !defined(HAVE_ATOQ) tmp_wide = atoll (tmp_char); #else -#ifdef HAVE_ATOQ tmp_wide = atoq (tmp_char); #endif #endif #endif -#endif XWINT (return_rtx, i) = tmp_wide; break; |