diff --git a/dmd/attrib.c b/dmd/attrib.c index d2f28d64..15410638 100644 --- a/dmd/attrib.c +++ b/dmd/attrib.c @@ -142,12 +142,6 @@ void AttribDeclaration::emitComment(Scope *sc) { //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 @@ void ConditionalDeclaration::emitComment(Scope *sc) { 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 diff --git a/dmd/doc.c b/dmd/doc.c index 2f904d2f..7b7f7bc4 100644 --- a/dmd/doc.c +++ b/dmd/doc.c @@ -857,6 +857,8 @@ void ClassDeclaration::toDocBuffer(OutBuffer *buf) } else { + if (isAbstract()) + buf->writestring("abstract "); buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); } int any = 0; diff --git a/dmd/expression.c b/dmd/expression.c index 2b68151a..469f5be2 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -3306,6 +3306,12 @@ TypeExp::TypeExp(Loc loc, Type *type) 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 @@ Lerror: else s = t->toChars(); error("%s cannot be sliced with []", s); - type = Type::terror; + e = new IntegerExp(0); return e; } diff --git a/dmd/expression.h b/dmd/expression.h index e57c3b95..d51b5f52 100644 --- a/dmd/expression.h +++ b/dmd/expression.h @@ -478,6 +478,7 @@ struct TypeDotIdExp : Expression struct TypeExp : Expression { TypeExp(Loc loc, Type *type); + Expression *syntaxCopy(); Expression *semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); Expression *optimize(int result); diff --git a/dmd/man.c b/dmd/man.c index 49b1bacf..d4a88cf7 100644 --- a/dmd/man.c +++ b/dmd/man.c @@ -37,7 +37,7 @@ void browse(const char *url) 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 @@ void browse(const char *url) #endif +#if __APPLE__ + +#include +#include +#include + +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 + + diff --git a/dmd/mars.c b/dmd/mars.c index 4fff893e..92c082c0 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -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 @@ Global::Global() 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 @@ int main(int argc, char *argv[]) switch(global.params.os) { case OSWindows: + // TODO Win64 stuff! VersionCondition::addPredefinedGlobalIdent("Windows"); VersionCondition::addPredefinedGlobalIdent("Win32"); VersionCondition::addPredefinedGlobalIdent("mingw32"); @@ -953,6 +954,10 @@ int main(int argc, char *argv[]) : (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(); diff --git a/dmd/mars.h b/dmd/mars.h index 02cbb798..0c9466eb 100644 --- a/dmd/mars.h +++ b/dmd/mars.h @@ -198,6 +198,12 @@ struct Global 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 diff --git a/dmd/template.c b/dmd/template.c index 15e8c078..f53aa552 100644 --- a/dmd/template.c +++ b/dmd/template.c @@ -3649,14 +3649,15 @@ int TemplateInstance::isNested(Objects *args) 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());