summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-03-18 09:55:53 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1998-03-18 09:55:53 +0000
commitbf5df944dff7622337570d9b738a96da436f0d89 (patch)
tree9865836d8f1059cd0102d063058ea0f8139fcf6a /gcc
parent474d50b33ab1d0865a645183d878fc6f489e5167 (diff)
downloadgcc-bf5df944dff7622337570d9b738a96da436f0d89.tar.gz
* 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>. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@18657 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/config/alpha/xm-vms.h1
-rw-r--r--gcc/rtl.c43
3 files changed, 50 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8b70fb71be3..cedf0084794 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+Wed Mar 18 09:52:56 1998 Richard Henderson <rth@cygnus.com>
+
+ * 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>.
+
Wed Mar 18 09:56:26 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* c-lang.c (finish_file): Wrap variable `void_list_node' with macro
diff --git a/gcc/config/alpha/xm-vms.h b/gcc/config/alpha/xm-vms.h
index 43ac5b62cfb..5e5a4422bcd 100644
--- a/gcc/config/alpha/xm-vms.h
+++ b/gcc/config/alpha/xm-vms.h
@@ -68,6 +68,7 @@ Boston, MA 02111-1307, USA. */
#define HAVE_VPRINTF
#define HAVE_PUTENV
#define HAVE_STRERROR
+#define HAVE_ATOLL
#define NO_SYS_PARAMS_H /* Don't have <sys/params.h> */
#define NO_STAB_H /* Don't have <stab.h> */
diff --git a/gcc/rtl.c b/gcc/rtl.c
index acfe6c2f406..1de50c21202 100644
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -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;