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]
Other format: [Raw text]

Re: COUNTER-[PATCH] 64 bit formatting directives on MingW32


 --- Christopher Faylor <cgf@redhat.com> wrote: > On Tue, Jul 15, 2003 at 06:12:39PM +1000, Danny
Smith wrote:
> > --- Earl Chew <earl_chew@agilent.com> wrote: > Danny Smith wrote:
> >> I encountered my original problem with building powerpc-wrs-vxworks
> >> hosted on MingW32.
> >> 
> >> When running the resulting cross-compiler, the backend wanted
> >> to use HOST_WIDE_INT_* to print a 64 bit quantity. I don't have
> >> the exact details at hand, but the comments on hwint.h suggest:
> >> 
> >> > /* Set HOST_WIDE_INT.  This should be the widest efficient host
> >> >    integer type.  It can be 32 or 64 bits, except that if we are
> >> >    targeting a machine with 64-bit size_t then it has to be 64 bits.
> >> 
> >
> >
> >> So it would appear that it might be possible that HOST_WIDE_INT_*
> >> needs to format a 64 bit quantity.
> >> 
> >> If this is indeed true, I think your patch needs some additions
> >> to accommodate this case.
> >> 
> >> Earl
> >>  
> >
> >Hi Earl
> >
> >Second version: Put the "I64" define in the host (not target) config file.
> >
> >This works on native bootstrap.  Can you try with your cross-build to
> >target that has 64-bit longs.
> 
> Assuming this passes Earle's tests, please feel free to check in.
> 
> cgf 

Umm, do I not need approval from someone with blanket write permission for the
(mechanical) change to hwint.h.

Danny

ChangeLog

2003-07-17  Danny Smith  <dannysmith@users.sourceforge.net>

	* hwint.h (HOST_LL_PREFIX): Define as "ll" by default.
	Replace "ll" with  HOST_LL_PREFIX thoughout.

Index: hwint.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/hwint.h,v
retrieving revision 1.17
diff -c -3 -p -r1.17 hwint.h
*** hwint.h	25 Jun 2003 19:33:08 -0000	1.17
--- hwint.h	15 Jul 2003 07:58:01 -0000
***************
*** 15,20 ****
--- 15,26 ----
  #define HOST_BITS_PER_INT   (CHAR_BIT * SIZEOF_INT)
  #define HOST_BITS_PER_LONG  (CHAR_BIT * SIZEOF_LONG)
  
+ /* On some hosts, runtime printf does not use standard long long prefix.
+    This allows override in host config file. */
+ #ifndef HOST_LL_PREFIX
+ # define HOST_LL_PREFIX "ll"
+ #endif
+ 
  /* If HAVE_LONG_LONG and SIZEOF_LONG_LONG aren't defined, but
     GCC_VERSION >= 3000, assume this is the second or later stage of a
     bootstrap, we do have long long, and it's 64 bits.  (This is
*************** extern char sizeof_long_long_must_be_8[s
*** 74,83 ****
  #  define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
  # endif
  #else
! # define HOST_WIDE_INT_PRINT "ll"
  # define HOST_WIDE_INT_PRINT_C "LL"
    /* We can assume that 'long long' is at least 64 bits.  */
! # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%llx%016llx"
  #endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
  
  #define HOST_WIDE_INT_PRINT_DEC "%" HOST_WIDE_INT_PRINT "d"
--- 80,89 ----
  #  define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%lx%08lx"
  # endif
  #else
! # define HOST_WIDE_INT_PRINT HOST_LL_PREFIX
  # define HOST_WIDE_INT_PRINT_C "LL"
    /* We can assume that 'long long' is at least 64 bits.  */
! # define HOST_WIDE_INT_PRINT_DOUBLE_HEX "0x%" HOST_LL_PREFIX "x%016" HOST_LL_PREFIX "x"
  #endif /* HOST_BITS_PER_WIDE_INT == HOST_BITS_PER_LONG */
  
  #define HOST_WIDE_INT_PRINT_DEC "%" HOST_WIDE_INT_PRINT "d"
*************** extern char sizeof_long_long_must_be_8[s
*** 109,119 ****
      #error "This line should be impossible to reach"
  #  endif
  # endif
! # define HOST_WIDEST_INT_PRINT_DEC	      "%lld"
! # define HOST_WIDEST_INT_PRINT_DEC_C	      "%lldLL"
! # define HOST_WIDEST_INT_PRINT_UNSIGNED	      "%llu"
! # define HOST_WIDEST_INT_PRINT_HEX	      "0x%llx"
! # define HOST_WIDEST_INT_PRINT_DOUBLE_HEX     "0x%llx%016llx"
  #endif
  
  #endif /* ! GCC_HWINT_H */
--- 115,125 ----
      #error "This line should be impossible to reach"
  #  endif
  # endif
! # define HOST_WIDEST_INT_PRINT_DEC	      "%" HOST_LL_PREFIX "d"
! # define HOST_WIDEST_INT_PRINT_DEC_C	      "%" HOST_LL_PREFIX "dLL"
! # define HOST_WIDEST_INT_PRINT_UNSIGNED	      "%" HOST_LL_PREFIX "u"
! # define HOST_WIDEST_INT_PRINT_HEX	      "0x%" HOST_LL_PREFIX "x"
! # define HOST_WIDEST_INT_PRINT_DOUBLE_HEX     "0x%" HOST_LL_PREFIX "x%016" HOST_LL_PREFIX "x"
  #endif
  
  #endif /* ! GCC_HWINT_H */

http://mobile.yahoo.com.au - Yahoo! Mobile
- Check & compose your email via SMS on your Telstra or Vodafone mobile.


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