changeset 136:9d194c848e3a

fixed a few null reference bugs, thx sagitario
author Trass3r
date Mon, 13 Sep 2010 23:27:38 +0200
parents c494af1dba80
children 09c858522d55
files dmd/DotIdExp.d dmd/FileName.d dmd/Json.d dmd/Optimize.d dmd/PragmaDeclaration.d dmd/Util.d dmd/backend/elem.d dmd/common.d
diffstat 8 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/DotIdExp.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/DotIdExp.d	Mon Sep 13 23:27:38 2010 +0200
@@ -155,7 +155,7 @@
 			{   
 				auto ee = te.exps[i];
 				ee = ee.semantic(sc);
-				ee = new DotIdExp(e.loc, ee, Id.offsetof);
+				ee = new DotIdExp(ee.loc, ee, Id.offsetof);
 				exps[i] = ee;
 			}
 			e = new TupleExp(loc, exps);
--- a/dmd/FileName.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/FileName.d	Mon Sep 13 23:27:38 2010 +0200
@@ -586,6 +586,8 @@
 	
     static void ensurePathExists(string path)
 	{
+		if (path.length == 0)
+			return;
 		try {
 			mkdirRecurse(path);
 		} catch {
--- a/dmd/Json.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/Json.d	Mon Sep 13 23:27:38 2010 +0200
@@ -24,7 +24,7 @@
 
 void json_generate(Array modules)
 {
-	OutBuffer buf;
+	OutBuffer buf = new OutBuffer();
 
 	buf.writestring("[\n");
 	for (int i = 0; i < modules.dim; i++)
--- a/dmd/Optimize.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/Optimize.d	Mon Sep 13 23:27:38 2010 +0200
@@ -22,7 +22,7 @@
 
     Expression e = null;
     if (!v)
-	return e;
+    	return e;
 
     if (v.isConst() || v.isInvariant() || v.storage_class & STC.STCmanifest)
     {
--- a/dmd/PragmaDeclaration.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/PragmaDeclaration.d	Mon Sep 13 23:27:38 2010 +0200
@@ -61,7 +61,7 @@
 					if (e.op == TOKstring)
 					{
 						auto se = cast(StringExp)e;
-						writef("%s", se.toChars()[1..$-2] /*se.len, cast(char*)se.string_*/);
+						writef("%s", se.toChars()[1..$-2]); // strip the '"'s, TODO: change to original?: /*se.len, cast(char*)se.string_*/
 					}
 					else
 						writef(e.toChars());
--- a/dmd/Util.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/Util.d	Mon Sep 13 23:27:38 2010 +0200
@@ -386,7 +386,7 @@
 						for ( ; *p2; p2++)
 						{   if (islower(*p2))
 								*p2 &= ~0x20;
-							else if (isspace(*p))
+							else if (isspace(*p2))
 								memmove(p2, p2 + 1, strlen(p2));
 							else if (*p2 == '=')
 							{
--- a/dmd/backend/elem.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/backend/elem.d	Mon Sep 13 23:27:38 2010 +0200
@@ -12,6 +12,7 @@
 import dmd.backend.TYPE;
 import dmd.backend.Util;
 import dmd.backend.Srcpos;
+import dmd.backend.OPER;
 
 /*********************************
  * Union of all data types. Storage allocated must be the right
@@ -92,8 +93,8 @@
     ushort	id;
 }
 
-    ubyte Eoper;	// operator (OPxxxx)
-    ubyte Ecount;	// # of parents of this elem - 1,
+    OPER	Eoper;	// operator (OPxxxx)
+    ubyte	Ecount;	// # of parents of this elem - 1,
 				// always 0 until CSE elimination is done
     eve EV;		// variants for each type of elem
 	
--- a/dmd/common.d	Fri Sep 10 19:14:09 2010 +0100
+++ b/dmd/common.d	Mon Sep 13 23:27:38 2010 +0200
@@ -60,6 +60,12 @@
 	version(MACHOBJ) {} else
 		static assert(false, "TARGET_OSX requires MACHOBJ");
 
+version(CCASTSYNTAX) {} else
+	static assert(false, `CCASTSYNTAX is needed for code like "(void*).sizeof"`);
+
+version(CARRAYDECL) {} else
+	static assert(false, "C array declarations are used in phobos so we still need CARRAYDECL");
+
 
 version(IN_GCC) // Changes for the GDC compiler by David Friedman
 {