changeset 876:27a379f288bf

Merged DMD 1.039
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 07 Jan 2009 19:34:48 +0100
parents 330f999ade44
children 05c9faedc13c
files dmd/attrib.c dmd/doc.c dmd/expression.c dmd/expression.h dmd/man.c dmd/mars.c dmd/mars.h dmd/template.c
diffstat 8 files changed, 79 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/attrib.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/attrib.c	Wed Jan 07 19:34:48 2009 +0100
@@ -142,12 +142,6 @@
 {
     //printf("AttribDeclaration::emitComment(sc = %p)\n", sc);
 
-    /* If generating doc comment, skip this because if we're inside
-     * a template, then include(NULL, NULL) will fail.
-     */
-//    if (sc->docbuf)
-//	return;
-
     Array *d = include(NULL, NULL);
 
     if (d)
@@ -1200,6 +1194,17 @@
     {
 	AttribDeclaration::emitComment(sc);
     }
+    else if (sc->docbuf)
+    {
+	/* If generating doc comment, be careful because if we're inside
+	 * a template, then include(NULL, NULL) will fail.
+	 */
+	Array *d = decl ? decl : elsedecl;
+	for (unsigned i = 0; i < d->dim; i++)
+	{   Dsymbol *s = (Dsymbol *)d->data[i];
+	    s->emitComment(sc);
+	}
+    }
 }
 
 // Decide if 'then' or 'else' code should be included
--- a/dmd/doc.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/doc.c	Wed Jan 07 19:34:48 2009 +0100
@@ -857,6 +857,8 @@
 	}
 	else
 	{
+	    if (isAbstract())
+		buf->writestring("abstract ");
 	    buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars());
 	}
 	int any = 0;
--- a/dmd/expression.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/expression.c	Wed Jan 07 19:34:48 2009 +0100
@@ -3306,6 +3306,12 @@
     this->type = type;
 }
 
+Expression *TypeExp::syntaxCopy()
+{
+    //printf("TypeExp::syntaxCopy()\n");
+    return new TypeExp(loc, type->syntaxCopy());
+}
+
 Expression *TypeExp::semantic(Scope *sc)
 {
     //printf("TypeExp::semantic(%s)\n", type->toChars());
@@ -7239,7 +7245,7 @@
     else
 	s = t->toChars();
     error("%s cannot be sliced with []", s);
-    type = Type::terror;
+    e = new IntegerExp(0);
     return e;
 }
 
--- a/dmd/expression.h	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/expression.h	Wed Jan 07 19:34:48 2009 +0100
@@ -478,6 +478,7 @@
 struct TypeExp : Expression
 {
     TypeExp(Loc loc, Type *type);
+    Expression *syntaxCopy();
     Expression *semantic(Scope *sc);
     void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
     Expression *optimize(int result);
--- a/dmd/man.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/man.c	Wed Jan 07 19:34:48 2009 +0100
@@ -37,7 +37,7 @@
     pid_t childpid;
     const char *args[3];
 
-    const char *browser = getenv("BROWSER");
+    char *browser = getenv("BROWSER");
     if (browser)
 	browser = strdup(browser);
     else
@@ -58,3 +58,43 @@
 
 #endif
 
+#if __APPLE__
+
+#include	<sys/types.h>
+#include	<sys/wait.h>
+#include	<unistd.h>
+
+void browse(const char *url)
+{
+    pid_t childpid;
+    const char *args[5];
+
+    char *browser = getenv("BROWSER");
+    if (browser)
+    {	browser = strdup(browser);
+	args[0] = browser;
+	args[1] = url;
+	args[2] = NULL;
+    }
+    else
+    {
+	//browser = "/Applications/Safari.app/Contents/MacOS/Safari";
+	args[0] = "open";
+	args[1] = "-a";
+	args[2] = "/Applications/Safari.app";
+	args[3] = url;
+	args[4] = NULL;
+    }
+
+    childpid = fork();
+    if (childpid == 0)
+    {
+	execvp(args[0], (char**)args);
+	perror(args[0]);		// failed to execute
+	return;
+    }
+}
+
+#endif
+
+
--- a/dmd/mars.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/mars.c	Wed Jan 07 19:34:48 2009 +0100
@@ -1,5 +1,5 @@
 // Compiler implementation of the D programming language
-// Copyright (c) 1999-2008 by Digital Mars
+// Copyright (c) 1999-2009 by Digital Mars
 // All Rights Reserved
 // written by Walter Bright
 // http://www.digitalmars.com
@@ -61,9 +61,9 @@
     obj_ext_alt = "obj";
 #endif
 
-    copyright = "Copyright (c) 1999-2008 by Digital Mars and Tomas Lindquist Olsen";
+    copyright = "Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen";
     written = "written by Walter Bright and Tomas Lindquist Olsen";
-    version = "v1.038";
+    version = "v1.039";
     ldc_version = LDC_REV;
     llvm_version = LLVM_REV;
     global.structalign = 8;
@@ -913,6 +913,7 @@
     switch(global.params.os)
     {
     case OSWindows:
+    // TODO Win64 stuff!
 	VersionCondition::addPredefinedGlobalIdent("Windows");
 	VersionCondition::addPredefinedGlobalIdent("Win32");
 	VersionCondition::addPredefinedGlobalIdent("mingw32");
@@ -953,6 +954,10 @@
         : (char*)(global.params.is64bit ? "E-p:64:64" : "E-p:32:32");
     Logger::println("Layout: %s", global.params.dataLayout);
 
+    // added in 1.039
+    if (global.params.doDocComments)
+        VersionCondition::addPredefinedGlobalIdent("D_Ddoc");
+
     // Initialization
     Type::init();
     Id::initialize();
--- a/dmd/mars.h	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/mars.h	Wed Jan 07 19:34:48 2009 +0100
@@ -198,6 +198,12 @@
 
 extern Global global;
 
+/* Set if Windows Structured Exception Handling C extensions are supported.
+ * Apparently, VC has dropped support for these?
+ */
+#define WINDOWS_SEH	(_WIN32 && __DMC__)
+
+
 #if __GNUC__
 //#define memicmp strncasecmp
 //#define stricmp strcasecmp
--- a/dmd/template.c	Tue Jan 06 16:33:51 2009 +0100
+++ b/dmd/template.c	Wed Jan 07 19:34:48 2009 +0100
@@ -3649,14 +3649,15 @@
 			    if (p == dparent)
 				goto L1;	// isnested is most nested
 			}
-			for (Dsymbol *p = dparent; 1; p = p->parent)
+			for (Dsymbol *p = dparent; p; p = p->parent)
 			{
 			    if (p == isnested)
 			    {	isnested = dparent;
 				goto L1;	// dparent is most nested
 			    }
 			}
-			error("is nested in both %s and %s", isnested->toChars(), dparent->toChars());
+			error("%s is nested in both %s and %s",
+				toChars(), isnested->toChars(), dparent->toChars());
 		    }
 		  L1:
 		    //printf("\tnested inside %s\n", isnested->toChars());