changeset 1416:17268b0a3ab0

Fix for mingw32 segfault
author Kelly Wilson <wilsonk cpsc.ucalgary.ca>
date Sat, 23 May 2009 14:59:04 -0600
parents bac3931b3de3
children c3c23d2c5407
files bin/ldmd dmd/root/root.c dmd/statement.c dmd2/root.c
diffstat 4 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/bin/ldmd	Sat May 23 20:57:22 2009 +0200
+++ b/bin/ldmd	Sat May 23 14:59:04 2009 -0600
@@ -1,4 +1,4 @@
-#! /usr/bin/env bash
+#! /usr/bin/env sh
 
 # Default to 'ldc' next to this file
 LDC=`basename "$0"`/ldc
--- a/dmd/root/root.c	Sat May 23 20:57:22 2009 +0200
+++ b/dmd/root/root.c	Sat May 23 14:59:04 2009 -0600
@@ -1668,7 +1668,7 @@
 // The compiler shipped with Visual Studio 2005 (and possible
 // other versions) does not support C99 printf format specfiers
 // such as %z and %j
-#if _MSC_VER
+#if _MSC_VER || __MINGW32__
 using std::string;
 using std::wstring;
 
--- a/dmd/statement.c	Sat May 23 20:57:22 2009 +0200
+++ b/dmd/statement.c	Sat May 23 14:59:04 2009 -0600
@@ -1739,7 +1739,11 @@
 		    default:		assert(0);
 		}
 		const char *r = (op == TOKforeach_reverse) ? "R" : "";
+#ifdef __MINGW32__
+		int j = sprintf(fdname, "_aApply%s%.*s%lu", r, 2, fntab[flag], dim);
+#else
 		int j = sprintf(fdname, "_aApply%s%.*s%zu", r, 2, fntab[flag], dim);
+#endif
 		assert(j < sizeof(fdname));
 		//LDC: Build arguments.
 		Arguments* args = new Arguments;
--- a/dmd2/root.c	Sat May 23 20:57:22 2009 +0200
+++ b/dmd2/root.c	Sat May 23 14:59:04 2009 -0600
@@ -1613,7 +1613,7 @@
 // The compiler shipped with Visual Studio 2005 (and possible
 // other versions) does not support C99 printf format specfiers
 // such as %z and %j
-#if _MSC_VER
+#if _MSC_VER || __MINGW32__
 using std::string;
 using std::wstring;