This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: CVS-19981209: Patch for "unsigned HOST_WIDE_INT" on Solaris2.6


Hi,

Does simply removing the #if HAVE_INTTYPES_H part solve your problem? If so, I think it's a better solution. Your patch has the same problem as one submitted earlier today in that if
HOST_WIDE_INT is already defined, the HOST_WIDE_UINT won't get defined.

Dave

Manfred Hollstein wrote:

> Today (with egcs from CVS as of 1998/12/09 10:12:02 +0100) I
> encountered:
>
> gcc -c  -DIN_GCC  -DSVR4 -DHAVE_CONFIG_H -DHAIFA    -I. -I../../egcs-19981209/gcc -I../../egcs-19981209/gcc/config -I../../egcs-19981209/gcc/../include ../../egcs-19981209/gcc/cppexp.c
> ../../egcs-19981209/gcc/cppexp.c: In function `cpp_parse_escape':
> ../../egcs-19981209/gcc/cppexp.c:536: syntax error before `i'
> ../../egcs-19981209/gcc/cppexp.c:552: `overflow' undeclared (first use in this function)
> ../../egcs-19981209/gcc/cppexp.c:552: (Each undeclared identifier is reported only once
> ../../egcs-19981209/gcc/cppexp.c:552: for each function it appears in.)
> ../../egcs-19981209/gcc/cppexp.c:552: `i' undeclared (first use in this function)
> ../../egcs-19981209/gcc/cppexp.c: In function `cpp_parse_expr':
> ../../egcs-19981209/gcc/cppexp.c:661: warning: `rprio' might be used uninitialized in this function
>
> This is caused  by cpplib.h  #include'ing  <inttypes.h> and  using the
> typedef'ed intmax_t for defining  HOST_WIDE_INT. Defining an "unsigned
> HOST_WIDE_INT" will then be trapped with the above error.
>
> I fixed it by introducing a new macro  HOST_WIDE_UINT, which maps onto
> 'uintmax_t' for  #ifdef   HAVE_INTTYPES_H, and simply uses   'unsigned
> HOST_WIDE_INT' else. I'm not sure, if my  patch is the appropriate way
> to go,  but it is working  for  me. I'm pretty   sure, there are other
> locations   where  the plain  'unsigned  HOST_WIDE_INT'  is used, too,
> though; I fixed only the one which caused egcs's bootstrap to fail.
>
> BTW, IMO we should  get  machmode.h and  cpplib.h in sync  about their
> opinion "how to #define HOST_WIDE_INT".
>
> manfred
>
> 1998-12-09  Manfred Hollstein  <manfred@s-direktnet.de>
>
>         * cpplib.h (HOST_WIDE_UINT): New macro to cope with typedef'ed
>         HOST_WIDE_INT types.
>         * cppexp.c (cpp_parse_escape): Use it instead of "unsigned HOST_WIDE_INT".
>
> diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981209.orig/gcc/cppexp.c egcs-19981209/gcc/cppexp.c
> --- egcs-19981209.orig/gcc/cppexp.c     Tue Dec  8 12:46:04 1998
> +++ egcs-19981209/gcc/cppexp.c  Wed Dec  9 15:22:54 1998
> @@ -533,7 +533,7 @@ cpp_parse_escape (pfile, string_ptr, res
>        }
>      case 'x':
>        {
> -       register unsigned HOST_WIDE_INT i = 0, overflow = 0;
> +       register HOST_WIDE_UINT i = 0, overflow = 0;
>         register int digits_found = 0, digit;
>         for (;;)
>           {
> diff -rup -x CVS -x RCS -x *.o -x *.info* -x *.html* -x *.elc -x *.dvi -x *.orig -x *~ -x version.el egcs-19981209.orig/gcc/cpplib.h egcs-19981209/gcc/cpplib.h
> --- egcs-19981209.orig/gcc/cpplib.h     Tue Dec  8 12:46:08 1998
> +++ egcs-19981209/gcc/cpplib.h  Wed Dec  9 15:22:02 1998
> @@ -671,6 +671,7 @@ typedef struct if_stack IF_STACK_FRAME;
>  # if HAVE_INTTYPES_H
>  #  include <inttypes.h>
>  #  define HOST_WIDE_INT intmax_t
> +#  define HOST_WIDE_UINT uintmax_t
>  # else
>  #  if (HOST_BITS_PER_LONG <= HOST_BITS_PER_INT \
>         && HOST_BITS_PER_LONGLONG <= HOST_BITS_PER_INT)
> @@ -683,6 +684,7 @@ typedef struct if_stack IF_STACK_FRAME;
>  #   define HOST_WIDE_INT long long
>  #  endif
>  #  endif
> +#  define HOST_WIDE_UINT unsigned HOST_WIDE_INT
>  # endif
>  #endif





Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]