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


 --- 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.


ChangeLog

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

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

	* config/i386/xm-mingw32.h (HOST_LL_PREFIX)) Define as "I64".
	* config/i386/x-mingw32: Add -Wno-format switch for files
	that use HOST_WIDEST_INT_PRINT*. 


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 */
Index: config/i386/xm-mingw32.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/xm-mingw32.h,v
retrieving revision 1.16
diff -c -3 -p -r1.16 xm-mingw32.h
*** config/i386/xm-mingw32.h	3 Jul 2003 04:24:00 -0000	1.16
--- config/i386/xm-mingw32.h	15 Jul 2003 07:58:01 -0000
*************** Boston, MA 02111-1307, USA.  */
*** 23,25 ****
--- 23,28 ----
  
  #undef PATH_SEPARATOR
  #define PATH_SEPARATOR ';'
+ 
+ /* Override the default of "ll" in hwint.t.  */
+ #define HOST_LL_PREFIX "I64"
Index: config/i386/x-mingw32
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/x-mingw32,v
retrieving revision 1.2
diff -c -3 -p -r1.2 x-mingw32
*** config/i386/x-mingw32	28 May 2003 21:06:23 -0000	1.2
--- config/i386/x-mingw32	15 Jul 2003 07:58:01 -0000
***************
*** 2,4 ****
--- 2,17 ----
  # Make local_includedir relative to EXEC_PREFIX 
  #
  local_includedir=$(libsubdir)/$(unlibsubdir)/..`echo $(exec_prefix) | sed -e 's|^$(prefix)||' -e
's|/[^/]*|/..|g'`/include
+ 
+ #
+ # host runtime lib's printf uses 'I64' format specifier prefix instead
+ # of 'll' for HOST_WIDEST_INT_PRINT_*. See hwint.h.
+ # Avoid warnings while bootstrapping.
+ #
+ bt-load.o-warn = -Wno-format
+ cfg.o-warn = -Wno-format
+ gcov-dump.o-warn = -Wno-format
+ gcov.o-warn = -Wno-format
+ loop-unroll.o-warn = -Wno-format
+ predict.o-warn = -Wno-format
+ profile.o-warn = -Wno-format

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]