diff dmd/Dsymbol.d @ 14:2cc604139636

Implemented Linux support for ddmd. Some parts are a bit hacky to just "get it working", that said, druntime and phobos compile, and unittests pass.
author Robert Clipsham <robert@octarineparrot.com>
date Sun, 04 Apr 2010 02:06:32 +0100
parents 10317f0c89a5
children ddae60498573
line wrap: on
line diff
--- a/dmd/Dsymbol.d	Wed Mar 31 16:29:36 2010 +0400
+++ b/dmd/Dsymbol.d	Sun Apr 04 02:06:32 2010 +0100
@@ -69,7 +69,8 @@
 import dmd.backend.LIST;
 
 import core.stdc.string : strcmp, memcpy, strlen;
-import core.stdc.stdlib : alloca;
+version (Bug4054) import core.memory;
+else import core.stdc.stdlib : alloca;
 
 import std.stdio;
 
@@ -322,6 +323,9 @@
 		}
 		--len;
 
+version (Bug4054)
+		char* s = cast(char*)GC.malloc(len);
+else
 		char* s = cast(char*)alloca(len);
 		char* q = s + len;
 
@@ -761,6 +765,9 @@
 
 		//printf("Dsymbol::toImport('%s')\n", sym->Sident);
 		n = sym.Sident.ptr;
+version (Bug4054)
+		id = cast(char*) GC.malloc(6 + strlen(n) + 1 + (type_paramsize_i(sym.Stype)).sizeof*3 + 1);
+else
 		id = cast(char*) alloca(6 + strlen(n) + 1 + (type_paramsize_i(sym.Stype)).sizeof*3 + 1);
 		if (sym.Stype.Tmangle == mTYman_std && tyfunc(sym.Stype.Tty))
 		{
@@ -803,6 +810,9 @@
 			n += 2;
 		}
 }
+		version (Bug4054)
+		id = cast(char*) GC.malloc(2 + nlen + size_t.sizeof * 3 + prefix.length + suffix.length + 1);
+		else
 		id = cast(char*) alloca(2 + nlen + size_t.sizeof * 3 + prefix.length + suffix.length + 1);
 		sprintf(id, "_D%.*s%lu%.*s%.*s", n, prefix.length, prefix, suffix);
 		
@@ -859,4 +869,4 @@
 version (TARGET_NET) {
     PragmaScope isPragmaScope() { return null; }
 }
-}
\ No newline at end of file
+}