This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: cpp issues
- To: brolley at cygnus dot com
- Subject: Re: cpp issues
- From: "Kaveh R. Ghazi" <ghazi at caip dot rutgers dot edu>
- Date: Wed, 10 Feb 1999 15:08:43 -0500 (EST)
- Cc: egcs at egcs dot cygnus dot com, law at cygnus dot com, zack at rabi dot columbia dot edu
> From: Dave Brolley <brolley@cygnus.com>
>
> Kaveh R. Ghazi wrote:
>
> > I was in a holding pattern because I couldn't bootstrap with
> > --enable-c-cpplib on Irix6 or OSF4. I was waiting for either Dave or
> > Zack to fix cpplib. See:
> >
> > http://www.cygnus.com/ml/egcs-patches/1998-Dec/0421.html
> > http://www.cygnus.com/ml/egcs-patches/1998-Dec/0428.html
> > http://www.cygnus.com/ml/egcs-patches/1999-Jan/0063.html
>
> As I recall, you were able to bootstrap on other platforms and that your
> patch had nothing to do with the Irix6 or OSF4 failures. I think you should
> submit another patch for us to look at.
> Dave
Fine. The first step is to agree on how we would define
HOST_WIDEST_INT, et al. Jeff had some comments, e.g.:
1. No use of unsigned_HOST_WIDEST_INT, (note the underscore after unsigned.)
2. No use of intmax_t. (Follows from #1 cause we can't say
"unsigned intmax_t".)
3. No checks if int > long. Ignore these brain damaged non-ansi hosts.
4. If long long > long and its available, use it, otherwise use long.
So I came up with the following patch to system.h. Note this can't go
in hwint.h because it requires limits.h to check if the implementation
supports long long. This mechanism has been in use in cccp.c for ages
so its pretty good. Since gcc supplies its own limits.h, this check
will work when we get to stage2. It has the advantage of also working
for other stage1 cc's that support long long. If that's not acceptable
for some reason, we can just rely on __GNUC__ instead of checking for
the limits.h macros. In that case, this could go into hwint.h.
If this is okay, the rest is mostly s/HOST_WIDE_INT/HOST_WIDEST_INT/
in cccp.c, cexp.y and cpp*.[ch]. Let me know and I'll put it together.
--Kaveh
--- orig/egcs-CVS19990209/gcc/system.h Tue Feb 9 20:13:19 1999
+++ egcs-CVS19990209/gcc/system.h Wed Feb 10 13:23:55 1999
@@ -159,6 +159,32 @@ extern int errno;
# include <limits.h>
#endif
+/* Find the largest host integer type and set its size and type.
+ HOST_WIDEST_INT differs from HOST_WIDE_INT in that the WIDE form
+ must fit into a register, whereas WIDEST can be larger. This must
+ appear after <limits.h> since we only use `long long' if its bigger
+ than a `long' and also if it is supported by macros in limits.h.
+ You won't get these defined if you don't include {ht}config.h
+ before this file. */
+
+#ifndef HOST_WIDEST_INT
+# if defined (HOST_BITS_PER_LONG) && defined (HOST_BITS_PER_LONGLONG)
+# if (HOST_BITS_PER_LONGLONG > HOST_BITS_PER_LONG) && (defined (LONG_LONG_MAX) || defined (LLONG_MAX))
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONGLONG
+# define HOST_WIDEST_INT long long
+# define HOST_WIDEST_INT_PRINT_DEC "%lld"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%llu"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%llx"
+# else
+# define HOST_BITS_PER_WIDEST_INT HOST_BITS_PER_LONG
+# define HOST_WIDEST_INT long
+# define HOST_WIDEST_INT_PRINT_DEC "%ld"
+# define HOST_WIDEST_INT_PRINT_UNSIGNED "%lu"
+# define HOST_WIDEST_INT_PRINT_HEX "0x%lx"
+# endif /* (long long > long) && (LONG_LONG_MAX || LLONG_MAX) */
+# endif /* defined(HOST_BITS_PER_LONG) && defined(HOST_BITS_PER_LONGLONG) */
+#endif /* ! HOST_WIDEST_INT */
+
#ifdef TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
--
Kaveh R. Ghazi Engagement Manager / Project Services
ghazi@caip.rutgers.edu Qwest Internet Solutions