diff dmd/mem.c @ 6:35d93ce68cf4 trunk

[svn r10] Updated for LLVM rev. 20070913 Applied fixes from wilsonk on the forum Some tweaks to work with gc 7.0 Fixed aggregate members of aggregates Fixed cyclic/recursive class declarations Other minor tweaks
author lindquist
date Wed, 26 Sep 2007 19:05:18 +0200
parents c53b6e3fe49a
children 23d0d9855cad
line wrap: on
line diff
--- a/dmd/mem.c	Wed Sep 05 07:16:31 2007 +0200
+++ b/dmd/mem.c	Wed Sep 26 19:05:18 2007 +0200
@@ -6,7 +6,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "gc.h"
+// I needed to perfix the dir after upgrading to gc 7.0
+#include "gc/gc.h"
 
 #include "mem.h"
 
@@ -14,10 +15,12 @@
  */
 
 Mem mem;
+static bool gc_was_init = false;
 
 void Mem::init()
 {
     GC_init();
+    gc_was_init = true;
 }
 
 char *Mem::strdup(const char *s)
@@ -127,7 +130,11 @@
 /* =================================================== */
 
 void * operator new(size_t m_size)
-{   
+{
+    // without this we segfault with gc 7.0
+    if (!gc_was_init) {
+        mem.init();
+    }
     void *p = GC_malloc(m_size);
     if (p)
 	return p;