Merged DMD 1.039

This commit is contained in:
Tomas Lindquist Olsen
2009-01-07 19:34:48 +01:00
parent 16409a3367
commit dcb9628849
8 changed files with 79 additions and 13 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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 <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

View File

@@ -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();

View File

@@ -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

View File

@@ -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());