changeset 3872:d7b2bb282421

mingw-w64: patch mingw-w64 for %g bug * dist-files.mk: add mingw-w64-3-fix-g-format.patch * src/mingw-w64-3-fix-g-format.patch: new file * src/build-gcc.mk: apply patches to mingw-w64 before building crt
author John Donoghue
date Mon, 06 Apr 2015 11:30:00 -0400
parents 34f28d854853
children 58aa10af640e
files dist-files.mk src/build-gcc.mk src/mingw-w64-3-fix-g-format.patch
diffstat 3 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dist-files.mk	Tue Mar 31 08:13:26 2015 -0400
+++ b/dist-files.mk	Mon Apr 06 11:30:00 2015 -0400
@@ -335,6 +335,7 @@
   mingw-utils-1-portability-fix.patch \
   mingw-w64-1-float-h.patch \
   mingw-w64-2-netioapi-winxp.patch \
+  mingw-w64-3-fix-g-format.patch \
   mingw-w64.mk \
   mingwrt.mk \
   mman-win32-1-include_name_change.patch \
--- a/src/build-gcc.mk	Tue Mar 31 08:13:26 2015 -0400
+++ b/src/build-gcc.mk	Mon Apr 06 11:30:00 2015 -0400
@@ -59,6 +59,10 @@
 
     # build mingw-w64-crt
     cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,mingw-w64,$(TAR))
+    $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/mingw-w64-*.patch)),
+      (cd '$(1)/$(mingw-w64_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
+    $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/$(MXE_SYSTEM)-mingw-w64-*.patch)),
+      (cd '$(1)/$(mingw-w64_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH))
     mkdir '$(1).crt-build'
     cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \
 	--host='$(TARGET)' \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/mingw-w64-3-fix-g-format.patch	Mon Apr 06 11:30:00 2015 -0400
@@ -0,0 +1,20 @@
+From: John Donoghue <john.david.donoghue@gmail.com>
+Date: Mon, 6 Apr 2015 09:29:43 -0400
+Subject: [PATCH] Fix printf("%g") width format out by one in some instances
+ (Bug 362)
+
+* mingw-w64-crt\stdio\mingw_pformat.c
+  (__pformat_emit_float): change width > len => width >= len
+
+diff -ur mingw-w64-v3.3.0.orig/mingw-w64-crt/stdio/mingw_pformat.c mingw-w64-v3.3.0/mingw-w64-crt/stdio/mingw_pformat.c
+--- mingw-w64-v3.3.0.orig/mingw-w64-crt/stdio/mingw_pformat.c	2015-04-06 10:12:45.486721000 -0400
++++ mingw-w64-v3.3.0/mingw-w64-crt/stdio/mingw_pformat.c	2015-04-06 10:14:26.200702676 -0400
+@@ -1055,7 +1055,7 @@
+      * reserve space in the output field, for the required number of
+      * decimal digits to be placed before the decimal point...
+      */
+-    if( stream->width > len )
++    if( stream->width >= len )
+       /*
+        * adjusting as appropriate, when width is sufficient...
+        */