Created
February 4, 2010 21:45
-
-
Save bhelyer/295154 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -r f7d31065be69 d/dmd2/aggregate.h | |
--- a/d/dmd2/aggregate.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/aggregate.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -127,7 +127,7 @@ | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
char *mangle(); | |
- char *kind(); | |
+ const char *kind(); | |
int needOpAssign(); | |
FuncDeclaration *buildOpAssign(Scope *sc); | |
FuncDeclaration *buildPostBlit(Scope *sc); | |
@@ -147,7 +147,7 @@ | |
{ | |
UnionDeclaration(Loc loc, Identifier *id); | |
Dsymbol *syntaxCopy(Dsymbol *s); | |
- char *kind(); | |
+ const char *kind(); | |
UnionDeclaration *isUnionDeclaration() { return this; } | |
}; | |
@@ -232,7 +232,7 @@ | |
#endif | |
int isAbstract(); | |
virtual int vtblOffset(); | |
- char *kind(); | |
+ const char *kind(); | |
char *mangle(); | |
void toDocBuffer(OutBuffer *buf); | |
@@ -264,7 +264,7 @@ | |
void semantic(Scope *sc); | |
int isBaseOf(ClassDeclaration *cd, target_ptrdiff_t *poffset); | |
int isBaseOf(BaseClass *bc, target_ptrdiff_t *poffset); | |
- char *kind(); | |
+ const char *kind(); | |
int vtblOffset(); | |
#if V2 | |
int isCPPinterface(); | |
diff -r f7d31065be69 d/dmd2/attrib.c | |
--- a/d/dmd2/attrib.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/attrib.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -214,7 +214,7 @@ | |
return 0; | |
} | |
-char *AttribDeclaration::kind() | |
+const char *AttribDeclaration::kind() | |
{ | |
return "attribute"; | |
} | |
@@ -711,9 +711,9 @@ | |
buf->writestring("}\n"); | |
} | |
-char *AnonDeclaration::kind() | |
+const char *AnonDeclaration::kind() | |
{ | |
- return (char *)(isunion ? "anonymous union" : "anonymous struct"); | |
+ return (isunion ? "anonymous union" : "anonymous struct"); | |
} | |
/********************************* PragmaDeclaration ****************************/ | |
@@ -1018,7 +1018,7 @@ | |
return TRUE; | |
} | |
-char *PragmaDeclaration::kind() | |
+const char *PragmaDeclaration::kind() | |
{ | |
return "pragma"; | |
} | |
@@ -1258,7 +1258,7 @@ | |
} | |
} | |
-char *StaticIfDeclaration::kind() | |
+const char *StaticIfDeclaration::kind() | |
{ | |
return "static if"; | |
} | |
@@ -1269,6 +1269,8 @@ | |
CompileDeclaration::CompileDeclaration(Loc loc, Expression *exp) | |
: AttribDeclaration(NULL) | |
{ | |
+ //printf("CompileDeclaration(loc = %d)\n", loc.linnum); | |
+ this->loc = loc; | |
this->exp = exp; | |
this->sd = NULL; | |
this->compiled = 0; | |
@@ -1296,12 +1298,12 @@ | |
void CompileDeclaration::compileIt(Scope *sc) | |
{ | |
- //printf("CompileDeclaration::compileIt()\n"); | |
+ //printf("CompileDeclaration::compileIt(loc = %d)\n", loc.linnum); | |
exp = exp->semantic(sc); | |
exp = resolveProperties(sc, exp); | |
exp = exp->optimize(WANTvalue | WANTinterpret); | |
if (exp->op != TOKstring) | |
- { error("argument to mixin must be a string, not (%s)", exp->toChars()); | |
+ { exp->error("argument to mixin must be a string, not (%s)", exp->toChars()); | |
} | |
else | |
{ | |
diff -r f7d31065be69 d/dmd2/attrib.h | |
--- a/d/dmd2/attrib.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/attrib.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -42,7 +42,7 @@ | |
void inlineScan(); | |
void addComment(unsigned char *comment); | |
void emitComment(Scope *sc); | |
- char *kind(); | |
+ const char *kind(); | |
int oneMember(Dsymbol **ps); | |
int hasPointers(); | |
void checkCtorConstInit(); | |
@@ -106,7 +106,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *s); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
struct PragmaDeclaration : AttribDeclaration | |
@@ -118,7 +118,7 @@ | |
void semantic(Scope *sc); | |
int oneMember(Dsymbol **ps); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
void toObjFile(int multiobj); // compile to .obj file | |
}; | |
@@ -145,7 +145,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *s); | |
int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
void semantic(Scope *sc); | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
// Mixin declarations | |
diff -r f7d31065be69 d/dmd2/class.c | |
--- a/d/dmd2/class.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/class.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -619,7 +619,7 @@ | |
if (!ctor && baseClass && baseClass->ctor) | |
{ | |
//printf("Creating default this(){} for class %s\n", toChars()); | |
- ctor = new CtorDeclaration(0, 0, NULL, 0); | |
+ ctor = new CtorDeclaration(loc, 0, NULL, 0); | |
ctor->fbody = new CompoundStatement(0, new Statements()); | |
members->push(ctor); | |
ctor->addMember(sc, this, 1); | |
@@ -981,7 +981,7 @@ | |
/**************************************** | |
*/ | |
-char *ClassDeclaration::kind() | |
+const char *ClassDeclaration::kind() | |
{ | |
return "class"; | |
} | |
@@ -1308,7 +1308,7 @@ | |
/******************************************* | |
*/ | |
-char *InterfaceDeclaration::kind() | |
+const char *InterfaceDeclaration::kind() | |
{ | |
return "interface"; | |
} | |
diff -r f7d31065be69 d/dmd2/constfold.c | |
--- a/d/dmd2/constfold.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/constfold.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -463,7 +463,7 @@ | |
n2 = e2->toInteger(); | |
if (n2 == 0) | |
{ e2->error("divide by 0"); | |
- e2 = new IntegerExp(0, 1, e2->type); | |
+ e2 = new IntegerExp(loc, 1, e2->type); | |
n2 = 1; | |
} | |
if (e1->type->isunsigned() || e2->type->isunsigned()) | |
@@ -526,7 +526,7 @@ | |
n2 = e2->toInteger(); | |
if (n2 == 0) | |
{ e2->error("divide by 0"); | |
- e2 = new IntegerExp(0, 1, e2->type); | |
+ e2 = new IntegerExp(loc, 1, e2->type); | |
n2 = 1; | |
} | |
if (e1->type->isunsigned() || e2->type->isunsigned()) | |
@@ -635,26 +635,21 @@ | |
} | |
Expression *And(Type *type, Expression *e1, Expression *e2) | |
-{ Expression *e; | |
- Loc loc = e1->loc; | |
- | |
- e = new IntegerExp(loc, e1->toInteger() & e2->toInteger(), type); | |
+{ | |
+ Expression *e; | |
+ e = new IntegerExp(e1->loc, e1->toInteger() & e2->toInteger(), type); | |
return e; | |
} | |
Expression *Or(Type *type, Expression *e1, Expression *e2) | |
{ Expression *e; | |
- Loc loc = e1->loc; | |
- | |
- e = new IntegerExp(loc, e1->toInteger() | e2->toInteger(), type); | |
+ e = new IntegerExp(e1->loc, e1->toInteger() | e2->toInteger(), type); | |
return e; | |
} | |
Expression *Xor(Type *type, Expression *e1, Expression *e2) | |
{ Expression *e; | |
- Loc loc = e1->loc; | |
- | |
- e = new IntegerExp(loc, e1->toInteger() ^ e2->toInteger(), type); | |
+ e = new IntegerExp(e1->loc, e1->toInteger() ^ e2->toInteger(), type); | |
return e; | |
} | |
@@ -1213,7 +1208,7 @@ | |
else | |
{ | |
error(loc, "cannot cast %s to %s", e1->type->toChars(), type->toChars()); | |
- e = new IntegerExp(loc, 0, type); | |
+ e = new IntegerExp(loc, 0, Type::tint32); | |
} | |
return e; | |
} | |
@@ -1539,7 +1534,7 @@ | |
if (type->toBasetype()->ty == Tsarray) | |
{ | |
- e->type = new TypeSArray(t1->nextOf(), new IntegerExp(0, es1->elements->dim, Type::tindex)); | |
+ e->type = new TypeSArray(t1->nextOf(), new IntegerExp(loc, es1->elements->dim, Type::tindex)); | |
e->type = e->type->semantic(loc, NULL); | |
} | |
else | |
@@ -1562,7 +1557,7 @@ | |
if (type->toBasetype()->ty == Tsarray) | |
{ | |
- e->type = new TypeSArray(e2->type, new IntegerExp(0, es1->elements->dim, Type::tindex)); | |
+ e->type = new TypeSArray(e2->type, new IntegerExp(loc, es1->elements->dim, Type::tindex)); | |
e->type = e->type->semantic(loc, NULL); | |
} | |
else | |
@@ -1579,7 +1574,7 @@ | |
if (type->toBasetype()->ty == Tsarray) | |
{ | |
- e->type = new TypeSArray(e1->type, new IntegerExp(0, es2->elements->dim, Type::tindex)); | |
+ e->type = new TypeSArray(e1->type, new IntegerExp(loc, es2->elements->dim, Type::tindex)); | |
e->type = e->type->semantic(loc, NULL); | |
} | |
else | |
diff -r f7d31065be69 d/dmd2/declaration.c | |
--- a/d/dmd2/declaration.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/declaration.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -46,7 +46,7 @@ | |
{ | |
} | |
-char *Declaration::kind() | |
+const char *Declaration::kind() | |
{ | |
return "declaration"; | |
} | |
@@ -173,7 +173,7 @@ | |
return NULL; | |
} | |
-char *TupleDeclaration::kind() | |
+const char *TupleDeclaration::kind() | |
{ | |
return "tuple"; | |
} | |
@@ -311,6 +311,7 @@ | |
attributes = sc->attributes; | |
if (sc->parent->isFuncDeclaration() && init) | |
semantic2(sc); | |
+ storage_class |= sc->stc & STCdeprecated; | |
} | |
else if (sem == 1) | |
{ | |
@@ -337,7 +338,7 @@ | |
} | |
} | |
-char *TypedefDeclaration::kind() | |
+const char *TypedefDeclaration::kind() | |
{ | |
return "typedef"; | |
} | |
@@ -541,7 +542,7 @@ | |
} | |
} | |
-char *AliasDeclaration::kind() | |
+const char *AliasDeclaration::kind() | |
{ | |
return "alias"; | |
} | |
@@ -1110,7 +1111,7 @@ | |
} | |
} | |
-char *VarDeclaration::kind() | |
+const char *VarDeclaration::kind() | |
{ | |
return "variable"; | |
} | |
@@ -1232,7 +1233,7 @@ | |
ei = init->isExpInitializer(); | |
else | |
{ | |
- Expression *e = type->defaultInit(); | |
+ Expression *e = type->defaultInit(loc); | |
if (e) | |
ei = new ExpInitializer(loc, e); | |
else | |
diff -r f7d31065be69 d/dmd2/declaration.h | |
--- a/d/dmd2/declaration.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/declaration.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -106,7 +106,7 @@ | |
Declaration(Identifier *id); | |
void semantic(Scope *sc); | |
- char *kind(); | |
+ const char *kind(); | |
target_size_t size(Loc loc); | |
void checkModify(Loc loc, Scope *sc, Type *t); | |
@@ -152,7 +152,7 @@ | |
TupleDeclaration(Loc loc, Identifier *ident, Objects *objects); | |
Dsymbol *syntaxCopy(Dsymbol *); | |
- char *kind(); | |
+ const char *kind(); | |
Type *getType(); | |
int needThis(); | |
@@ -176,7 +176,7 @@ | |
void semantic(Scope *sc); | |
void semantic2(Scope *sc); | |
char *mangle(); | |
- char *kind(); | |
+ const char *kind(); | |
Type *getType(); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
#ifdef _DH | |
@@ -209,7 +209,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
int overloadInsert(Dsymbol *s); | |
- char *kind(); | |
+ const char *kind(); | |
Type *getType(); | |
Dsymbol *toAlias(); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
@@ -245,7 +245,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
void semantic2(Scope *sc); | |
- char *kind(); | |
+ const char *kind(); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
#ifdef _DH | |
Type *htype; | |
@@ -567,7 +567,7 @@ | |
void inlineScan(); | |
int canInline(int hasthis, int hdrscan = 0); | |
Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments); | |
- char *kind(); | |
+ const char *kind(); | |
void toDocBuffer(OutBuffer *buf); | |
FuncDeclaration *isUnique(); | |
int needsClosure(); | |
@@ -593,7 +593,7 @@ | |
FuncAliasDeclaration(FuncDeclaration *funcalias); | |
FuncAliasDeclaration *isFuncAliasDeclaration() { return this; } | |
- char *kind(); | |
+ const char *kind(); | |
Symbol *toSymbol(); | |
}; | |
@@ -606,9 +606,10 @@ | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
Dsymbol *syntaxCopy(Dsymbol *); | |
int isNested(); | |
+ int isVirtual(); | |
FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; } | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
struct CtorDeclaration : FuncDeclaration | |
@@ -619,7 +620,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
char *toChars(); | |
int isVirtual(); | |
int addPreInvariant(); | |
@@ -733,7 +734,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
int isVirtual(); | |
int addPreInvariant(); | |
int addPostInvariant(); | |
@@ -749,7 +750,7 @@ | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
int isDelete(); | |
int isVirtual(); | |
int addPreInvariant(); | |
diff -r f7d31065be69 d/dmd2/doc.c | |
--- a/d/dmd2/doc.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/doc.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -417,8 +417,9 @@ | |
else if (isTemplateDeclaration()) | |
m = "$(DDOC_TEMPLATE_MEMBERS \n"; | |
- // BUG: if no members are actually printed, we should not emit DDOC_MEMBERS | |
+ unsigned offset1 = buf->offset; // save starting offset | |
buf->writestring(m); | |
+ unsigned offset2 = buf->offset; // to see if we write anything | |
sc = sc->push(this); | |
for (int i = 0; i < members->dim; i++) | |
{ | |
@@ -427,7 +428,14 @@ | |
s->emitComment(sc); | |
} | |
sc->pop(); | |
- buf->writestring(")\n"); | |
+ if (buf->offset == offset2) | |
+ { | |
+ /* Didn't write out any members, so back out last write | |
+ */ | |
+ buf->offset = offset1; | |
+ } | |
+ else | |
+ buf->writestring(")\n"); | |
} | |
} | |
@@ -448,7 +456,9 @@ | |
void Dsymbol::emitComment(Scope *sc) { } | |
void InvariantDeclaration::emitComment(Scope *sc) { } | |
+#if V2 | |
void PostBlitDeclaration::emitComment(Scope *sc) { } | |
+#endif | |
void DtorDeclaration::emitComment(Scope *sc) { } | |
void StaticCtorDeclaration::emitComment(Scope *sc) { } | |
void StaticDtorDeclaration::emitComment(Scope *sc) { } | |
@@ -525,12 +535,8 @@ | |
//printf("TemplateDeclaration::emitComment() '%s', kind = %s\n", toChars(), kind()); | |
if (prot() == PROTprivate) | |
return; | |
- if (!comment) | |
- return; | |
- OutBuffer *buf = sc->docbuf; | |
- DocComment *dc = DocComment::parse(sc, this, comment); | |
- unsigned o; | |
+ unsigned char *com = comment; | |
int hasmembers = 1; | |
Dsymbol *ss = this; | |
@@ -542,12 +548,22 @@ | |
{ | |
ss = onemember->isFuncDeclaration(); | |
if (ss) | |
- hasmembers = 0; | |
+ { hasmembers = 0; | |
+ if (com != ss->comment) | |
+ com = Lexer::combineComments(com, ss->comment); | |
+ } | |
else | |
ss = this; | |
} | |
} | |
+ if (!com) | |
+ return; | |
+ | |
+ OutBuffer *buf = sc->docbuf; | |
+ DocComment *dc = DocComment::parse(sc, this, com); | |
+ unsigned o; | |
+ | |
if (!dc) | |
{ | |
ss->emitDitto(sc); | |
@@ -744,7 +760,7 @@ | |
(td = parent->isTemplateDeclaration()) != NULL && | |
td->onemember == this) | |
{ /* It's a function template | |
- */ | |
+ */ | |
HdrGenState hgs; | |
unsigned o = buf->offset; | |
TypeFunction *tf = (TypeFunction *)type; | |
diff -r f7d31065be69 d/dmd2/dsymbol.c | |
--- a/d/dmd2/dsymbol.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/dsymbol.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -192,7 +192,7 @@ | |
return loc.toChars(); | |
} | |
-char *Dsymbol::kind() | |
+const char *Dsymbol::kind() | |
{ | |
return "symbol"; | |
} | |
@@ -612,7 +612,7 @@ | |
a.push(s); | |
} | |
-char *OverloadSet::kind() | |
+const char *OverloadSet::kind() | |
{ | |
return "overloadset"; | |
} | |
@@ -846,7 +846,7 @@ | |
return sprev; | |
} | |
-char *ScopeDsymbol::kind() | |
+const char *ScopeDsymbol::kind() | |
{ | |
return "ScopeDsymbol"; | |
} | |
diff -r f7d31065be69 d/dmd2/dsymbol.h | |
--- a/d/dmd2/dsymbol.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/dsymbol.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -120,7 +120,7 @@ | |
static Array *arraySyntaxCopy(Array *a); | |
- virtual char *kind(); | |
+ virtual const char *kind(); | |
virtual Dsymbol *toAlias(); // resolve real symbol | |
virtual int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
virtual void semantic(Scope *sc); | |
@@ -233,7 +233,7 @@ | |
void defineRef(Dsymbol *s); | |
static void multiplyDefined(Loc loc, Dsymbol *s1, Dsymbol *s2); | |
Dsymbol *nameCollision(Dsymbol *s); | |
- char *kind(); | |
+ const char *kind(); | |
FuncDeclaration *findGetMembers(); | |
void emitMemberComments(Scope *sc); | |
@@ -282,7 +282,7 @@ | |
OverloadSet(); | |
void push(Dsymbol *s); | |
OverloadSet *isOverloadSet() { return this; } | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
// Table of Dsymbol's | |
diff -r f7d31065be69 d/dmd2/e2ir.c | |
--- a/d/dmd2/e2ir.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/e2ir.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -482,7 +482,7 @@ | |
/************************************ | |
*/ | |
-elem *sarray_toDarray(Type *tfrom, Type *tto, elem *e) | |
+elem *sarray_toDarray(Loc loc, Type *tfrom, Type *tto, elem *e) | |
{ | |
//printf("sarray_toDarray()\n"); | |
//elem_print(e); | |
@@ -498,7 +498,7 @@ | |
if ((dim * fsize) % tsize != 0) | |
{ | |
Lerr: | |
- error((Loc)0, "cannot cast %s to %s since sizes don't line up", tfrom->toChars(), tto->toChars()); | |
+ error(loc, "cannot cast %s to %s since sizes don't line up", tfrom->toChars(), tto->toChars()); | |
} | |
dim = (dim * fsize) / tsize; | |
} | |
@@ -1834,7 +1834,7 @@ | |
(tb2->ty == Tarray || tb2->ty == Tsarray) | |
) | |
{ | |
- error("Array operations not implemented"); | |
+ error("Array operation %s not implemented", toChars()); | |
} | |
else | |
e = toElemBin(irs,OPadd); | |
@@ -2064,8 +2064,14 @@ | |
ea2 = e2->toElem(irs); | |
ea2 = array_toDarray(t2, ea2); | |
+#if 1 | |
+ ep = el_params(telement->arrayOf()->getInternalTypeInfo(NULL)->toElem(irs), | |
+ ea2, ea1, NULL); | |
+ rtlfunc = RTLSYM_ARRAYCMP2; | |
+#else | |
ep = el_params(telement->getInternalTypeInfo(NULL)->toElem(irs), ea2, ea1, NULL); | |
rtlfunc = RTLSYM_ARRAYCMP; | |
+#endif | |
e = el_bin(OPcall, TYint, el_var(rtlsym[rtlfunc]), ep); | |
e = el_bin(eop, TYint, e, el_long(TYint, 0)); | |
el_setLoc(e,loc); | |
@@ -2151,8 +2157,14 @@ | |
ea2 = e2->toElem(irs); | |
ea2 = array_toDarray(t2, ea2); | |
+#if 1 | |
+ ep = el_params(telement->arrayOf()->getInternalTypeInfo(NULL)->toElem(irs), | |
+ ea2, ea1, NULL); | |
+ rtlfunc = RTLSYM_ARRAYEQ2; | |
+#else | |
ep = el_params(telement->getInternalTypeInfo(NULL)->toElem(irs), ea2, ea1, NULL); | |
rtlfunc = RTLSYM_ARRAYEQ; | |
+#endif | |
e = el_bin(OPcall, TYint, el_var(rtlsym[rtlfunc]), ep); | |
if (op == TOKnotequal) | |
e = el_bin(OPxor, TYint, e, el_long(TYint, 1)); | |
@@ -2478,6 +2490,44 @@ | |
//elem_print(e); | |
goto Lret; | |
} | |
+ else if (e2->op == TOKadd || e2->op == TOKmin) | |
+ { | |
+ /* It's ea[] = eb[] +- ec[] | |
+ */ | |
+ BinExp *e2a = (BinExp *)e2; | |
+ Type *t = e2->type->toBasetype()->nextOf()->toBasetype(); | |
+ if (t->ty != Tfloat32 && t->ty != Tfloat64 && t->ty != Tfloat80) | |
+ { | |
+ e2->error("array add/min for %s not supported", t->toChars()); | |
+ return el_long(TYint, 0); | |
+ } | |
+ elem *ea = e1->toElem(irs); | |
+ ea = array_toDarray(e1->type, ea); | |
+ elem *eb = e2a->e1->toElem(irs); | |
+ eb = array_toDarray(e2a->e1->type, eb); | |
+ elem *ec = e2a->e2->toElem(irs); | |
+ ec = array_toDarray(e2a->e2->type, ec); | |
+ | |
+ int rtl = RTLSYM_ARRAYASSADDFLOAT; | |
+ if (t->ty == Tfloat64) | |
+ rtl = RTLSYM_ARRAYASSADDDOUBLE; | |
+ else if (t->ty == Tfloat80) | |
+ rtl = RTLSYM_ARRAYASSADDREAL; | |
+ if (e2->op == TOKmin) | |
+ { | |
+ rtl = RTLSYM_ARRAYASSMINFLOAT; | |
+ if (t->ty == Tfloat64) | |
+ rtl = RTLSYM_ARRAYASSMINDOUBLE; | |
+ else if (t->ty == Tfloat80) | |
+ rtl = RTLSYM_ARRAYASSMINREAL; | |
+ } | |
+ | |
+ /* Set parameters so the order of evaluation is eb, ec, ea | |
+ */ | |
+ elem *ep = el_params(eb, ec, ea, NULL); | |
+ e = el_bin(OPcall, type->totym(), el_var(rtlsym[rtl]), ep); | |
+ goto Lret; | |
+ } | |
else | |
{ | |
/* It's array1[]=array2[] | |
@@ -4093,7 +4143,7 @@ | |
} | |
else if (t1->ty == Tsarray) | |
{ | |
- e = sarray_toDarray(t1, NULL, e); | |
+ e = sarray_toDarray(loc, t1, NULL, e); | |
} | |
el_setLoc(e,loc); | |
return e; | |
diff -r f7d31065be69 d/dmd2/enum.c | |
--- a/d/dmd2/enum.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/enum.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -1,5 +1,5 @@ | |
-// Copyright (c) 1999-2007 by Digital Mars | |
+// Copyright (c) 1999-2008 by Digital Mars | |
// All Rights Reserved | |
// written by Walter Bright | |
// http://www.digitalmars.com | |
@@ -23,6 +23,7 @@ | |
#include "id.h" | |
#include "expression.h" | |
#include "module.h" | |
+#include "declaration.h" | |
/********************************* EnumDeclaration ****************************/ | |
@@ -38,6 +39,7 @@ | |
sinit = NULL; | |
scope = NULL; | |
attributes = NULL; | |
+ isdeprecated = 0; | |
} | |
Dsymbol *EnumDeclaration::syntaxCopy(Dsymbol *s) | |
@@ -86,6 +88,9 @@ | |
scope = NULL; | |
} | |
+ if (sc->stc & STCdeprecated) | |
+ isdeprecated = 1; | |
+ | |
parent = sc->parent; | |
if (attributes) | |
attributes->append(sc->attributes); | |
@@ -318,11 +323,16 @@ | |
return type; | |
} | |
-char *EnumDeclaration::kind() | |
+const char *EnumDeclaration::kind() | |
{ | |
return "enum"; | |
} | |
+int EnumDeclaration::isDeprecated() | |
+{ | |
+ return isdeprecated; | |
+} | |
+ | |
Dsymbol *EnumDeclaration::search(Loc loc, Identifier *ident, int flags) | |
{ | |
//printf("%s.EnumDeclaration::search('%s')\n", toChars(), ident->toChars()); | |
@@ -385,7 +395,7 @@ | |
} | |
} | |
-char *EnumMember::kind() | |
+const char *EnumMember::kind() | |
{ | |
return "enum member"; | |
} | |
diff -r f7d31065be69 d/dmd2/enum.h | |
--- a/d/dmd2/enum.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/enum.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -1,6 +1,6 @@ | |
// Compiler implementation of the D programming language | |
-// Copyright (c) 1999-2006 by Digital Mars | |
+// Copyright (c) 1999-2008 by Digital Mars | |
// All Rights Reserved | |
// written by Walter Bright | |
// http://www.digitalmars.com | |
@@ -38,12 +38,19 @@ | |
Type *type; // the TypeEnum | |
Type *memtype; // type of the members | |
+#if V1 | |
+ integer_t maxval; | |
+ integer_t minval; | |
+ integer_t defaultval; // default initializer | |
+#else | |
Expression *maxval; | |
Expression *minval; | |
Expression *defaultval; // default initializer | |
Scope *scope; // !=NULL means context to use | |
- Expressions * attributes; // GCC decl/type attributes | |
+ Expressions* attributes; | |
+#endif | |
+ int isdeprecated; | |
EnumDeclaration(Loc loc, Identifier *id, Type *memtype); | |
Dsymbol *syntaxCopy(Dsymbol *s); | |
@@ -51,8 +58,11 @@ | |
int oneMember(Dsymbol **ps); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
Type *getType(); | |
- char *kind(); | |
+ const char *kind(); | |
+#if V2 | |
Dsymbol *search(Loc, Identifier *ident, int flags); | |
+#endif | |
+ int isDeprecated(); // is Dsymbol deprecated? | |
void emitComment(Scope *sc); | |
void toDocBuffer(OutBuffer *buf); | |
@@ -76,7 +86,7 @@ | |
EnumMember(Loc loc, Identifier *id, Expression *value, Type *type); | |
Dsymbol *syntaxCopy(Dsymbol *s); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
void emitComment(Scope *sc); | |
void toDocBuffer(OutBuffer *buf); | |
diff -r f7d31065be69 d/dmd2/expression.c | |
--- a/d/dmd2/expression.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/expression.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -60,6 +60,7 @@ | |
#include "parse.h" | |
Expression *createTypeInfoArray(Scope *sc, Expression *args[], int dim); | |
+Expression *expandVar(int result, VarDeclaration *v); | |
#define LOGSEMANTIC 0 | |
@@ -269,7 +270,7 @@ | |
/* Can't find a path from e1 to ad | |
*/ | |
- error("this for %s needs to be type %s not type %s", | |
+ e1->error("this for %s needs to be type %s not type %s", | |
var->toChars(), ad->toChars(), t->toChars()); | |
} | |
} | |
@@ -821,6 +822,7 @@ | |
Expression::Expression(Loc loc, enum TOK op, int size) | |
: loc(loc) | |
{ | |
+ //printf("Expression::Expression(op = %d) this = %p\n", op, this); | |
this->loc = loc; | |
this->op = op; | |
this->size = size; | |
@@ -851,6 +853,7 @@ | |
assert(0); | |
} | |
e = (Expression *)mem.malloc(size); | |
+ //printf("Expression::copy(op = %d) e = %p\n", op, e); | |
return (Expression *)memcpy(e, this, size); | |
} | |
@@ -973,7 +976,7 @@ | |
int Expression::isLvalue() | |
{ | |
- return 0; | |
+ return 0; | |
} | |
/******************************* | |
@@ -1287,8 +1290,13 @@ | |
} | |
default: | |
- type->print(); | |
- assert(0); | |
+ /* This can happen if errors, such as | |
+ * the type is painted on like in fromConstInitializer(). | |
+ */ | |
+ if (!global.errors) | |
+ { type->print(); | |
+ assert(0); | |
+ } | |
break; | |
} | |
break; | |
@@ -1440,10 +1448,17 @@ | |
goto L3; | |
default: | |
+ /* This can happen if errors, such as | |
+ * the type is painted on like in fromConstInitializer(). | |
+ */ | |
+ if (!global.errors) | |
+ { | |
#ifdef DEBUG | |
- t->print(); | |
-#endif | |
- assert(0); | |
+ t->print(); | |
+#endif | |
+ assert(0); | |
+ } | |
+ break; | |
} | |
} | |
else if (v & 0x8000000000000000LL) | |
@@ -1921,7 +1936,7 @@ | |
int IdentifierExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *IdentifierExp::toLvalue(Scope *sc, Expression *e) | |
@@ -2204,7 +2219,7 @@ | |
type = var->type; | |
var->isVarDeclaration()->checkNestedReference(sc, loc); | |
if (!sc->intypeof) | |
- sc->callSuper |= CSXthis; | |
+ sc->callSuper |= CSXthis; | |
return this; | |
Lerr: | |
@@ -2225,7 +2240,7 @@ | |
int ThisExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *ThisExp::toLvalue(Scope *sc, Expression *e) | |
@@ -2311,7 +2326,7 @@ | |
var->isVarDeclaration()->checkNestedReference(sc, loc); | |
if (!sc->intypeof) | |
- sc->callSuper |= CSXsuper; | |
+ sc->callSuper |= CSXsuper; | |
return this; | |
@@ -3094,7 +3109,7 @@ | |
int StructLiteralExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *StructLiteralExp::toLvalue(Scope *sc, Expression *e) | |
@@ -3898,7 +3913,7 @@ | |
int OverExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *OverExp::toLvalue(Scope *sc, Expression *e) | |
@@ -4245,6 +4260,8 @@ | |
#endif | |
typeidType = typeidType->semantic(loc, sc); | |
e = typeidType->getTypeInfo(sc); | |
+ if (e->loc.linnum == 0) | |
+ e->loc = loc; // so there's at least some line number info | |
return e; | |
} | |
@@ -5385,6 +5402,11 @@ | |
e1 = getRightThis(loc, sc, ad, e1, var); | |
if (!sc->noaccesscheck) | |
accessCheck(loc, sc, e1, var); | |
+ | |
+ VarDeclaration *v = var->isVarDeclaration(); | |
+ Expression *e = expandVar(WANTvalue, v); | |
+ if (e) | |
+ return e; | |
} | |
} | |
//printf("-DotVarExp::semantic('%s')\n", toChars()); | |
@@ -5393,7 +5415,7 @@ | |
int DotVarExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *DotVarExp::toLvalue(Scope *sc, Expression *e) | |
@@ -5601,7 +5623,7 @@ | |
return e; | |
Lerr: | |
- return new IntegerExp(0); | |
+ return new IntegerExp(loc, 0, Type::tint32); | |
} | |
void DotTemplateInstanceExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) | |
@@ -5796,15 +5818,15 @@ | |
/* Attempt to instantiate ti. If that works, go with it. | |
* If not, go with partial explicit specialization. | |
*/ | |
- ti->semanticTiargs(sc); | |
+ ti->semanticTiargs(sc); | |
unsigned errors = global.errors; | |
global.gag++; | |
ti->semantic(sc); | |
global.gag--; | |
if (errors != global.errors) | |
{ | |
- /* Didn't work, go with partial explicit specialization | |
- */ | |
+ /* Didn't work, go with partial explicit specialization | |
+ */ | |
global.errors = errors; | |
targsi = ti->tiargs; | |
e1 = new IdentifierExp(loc, ti->name); | |
@@ -5823,7 +5845,7 @@ | |
/* Attempt to instantiate ti. If that works, go with it. | |
* If not, go with partial explicit specialization. | |
*/ | |
- ti->semanticTiargs(sc); | |
+ ti->semanticTiargs(sc); | |
Expression *etmp; | |
unsigned errors = global.errors; | |
global.gag++; | |
@@ -5976,6 +5998,17 @@ | |
if (f->needThis()) | |
ue->e1 = getRightThis(loc, sc, ad, ue->e1, f); | |
+ /* Cannot call public functions from inside invariant | |
+ * (because then the invariant would have infinite recursion) | |
+ */ | |
+ if (sc->func && sc->func->isInvariantDeclaration() && | |
+ ue->e1->op == TOKthis && | |
+ f->addPostInvariant() | |
+ ) | |
+ { | |
+ error("cannot call public/export function %s from invariant", f->toChars()); | |
+ } | |
+ | |
checkDeprecated(sc, f); | |
accessCheck(loc, sc, ue->e1, f); | |
if (!f->needThis()) | |
@@ -6433,7 +6466,7 @@ | |
int PtrExp::isLvalue() | |
{ | |
- return 1; | |
+ return 1; | |
} | |
Expression *PtrExp::toLvalue(Scope *sc, Expression *e) | |
diff -r f7d31065be69 d/dmd2/func.c | |
--- a/d/dmd2/func.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/func.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -113,6 +113,7 @@ | |
StructDeclaration *sd; | |
ClassDeclaration *cd; | |
InterfaceDeclaration *id; | |
+ Dsymbol *pd; | |
#if 0 | |
printf("FuncDeclaration::semantic(sc = %p, this = %p, '%s', linkage = %d)\n", sc, this, toPrettyChars(), sc->linkage); | |
@@ -265,6 +266,18 @@ | |
error("function body is not abstract in interface %s", id->toChars()); | |
} | |
+ /* Template member functions aren't virtual: | |
+ * interface TestInterface { void tpl(T)(); } | |
+ * and so won't work in interfaces | |
+ */ | |
+ if ((pd = toParent()) != NULL && | |
+ pd->isTemplateInstance() && | |
+ (pd = toParent2()) != NULL && | |
+ (id = pd->isInterfaceDeclaration()) != NULL) | |
+ { | |
+ error("template member function not allowed in interface %s", id->toChars()); | |
+ } | |
+ | |
cd = parent->isClassDeclaration(); | |
if (cd) | |
{ int vi; | |
@@ -1991,7 +2004,7 @@ | |
{ | |
#if 0 | |
printf("FuncDeclaration::isVirtual(%s)\n", toChars()); | |
- printf("%p %d %d %d %d\n", isMember(), isStatic(), protection == PROTprivate, isCtorDeclaration(), linkage != LINKd); | |
+ printf("isMember:%p isStatic:%d private:%d ctor:%d !Dlinkage:%d\n", isMember(), isStatic(), protection == PROTprivate, isCtorDeclaration(), linkage != LINKd); | |
printf("result is %d\n", | |
isMember() && | |
!(isStatic() || protection == PROTprivate || protection == PROTpackage) && | |
@@ -2082,14 +2095,12 @@ | |
* Generate a FuncDeclaration for a runtime library function. | |
*/ | |
-FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, char *name, | |
- Type *t1, Type *t2, Type *t3) | |
+FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, char *name, Type *t1, Type *t2, Type *t3) | |
{ | |
- return genCfunc(treturn, Lexer::idPool(name), t1, t2, t3); | |
+ return genCfunc(treturn, Lexer::idPool(name)); | |
} | |
-FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, Identifier *id, | |
- Type *t1, Type *t2, Type *t3) | |
+FuncDeclaration *FuncDeclaration::genCfunc(Type *treturn, Identifier *id, Type *t1, Type *t2, Type *t3) | |
{ | |
FuncDeclaration *fd; | |
TypeFunction *tf; | |
@@ -2133,7 +2144,7 @@ | |
return fd; | |
} | |
-char *FuncDeclaration::kind() | |
+const char *FuncDeclaration::kind() | |
{ | |
return "function"; | |
} | |
@@ -2176,7 +2187,7 @@ | |
goto Lyes; // assume f escapes this function's scope | |
// Look to see if any parents of f that are below this escape | |
- for (Dsymbol *s = f->parent; s != this; s = s->parent) | |
+ for (Dsymbol *s = f->parent; s && s != this; s = s->parent) | |
{ | |
f = s->isFuncDeclaration(); | |
if (f && (f->isThis() || f->tookAddressOf)) | |
@@ -2204,7 +2215,7 @@ | |
this->funcalias = funcalias; | |
} | |
-char *FuncAliasDeclaration::kind() | |
+const char *FuncAliasDeclaration::kind() | |
{ | |
return "function alias"; | |
} | |
@@ -2249,7 +2260,12 @@ | |
return (tok == TOKdelegate); | |
} | |
-char *FuncLiteralDeclaration::kind() | |
+int FuncLiteralDeclaration::isVirtual() | |
+{ | |
+ return FALSE; | |
+} | |
+ | |
+const char *FuncLiteralDeclaration::kind() | |
{ | |
// GCC requires the (char*) casts | |
return (tok == TOKdelegate) ? (char*)"delegate" : (char*)"function"; | |
@@ -2348,7 +2364,7 @@ | |
cd->defaultCtor = this; | |
} | |
-char *CtorDeclaration::kind() | |
+const char *CtorDeclaration::kind() | |
{ | |
return "constructor"; | |
} | |
@@ -2947,7 +2963,7 @@ | |
FuncDeclaration::semantic(sc); | |
} | |
-char *NewDeclaration::kind() | |
+const char *NewDeclaration::kind() | |
{ | |
return "allocator"; | |
} | |
@@ -3031,7 +3047,7 @@ | |
FuncDeclaration::semantic(sc); | |
} | |
-char *DeleteDeclaration::kind() | |
+const char *DeleteDeclaration::kind() | |
{ | |
return "deallocator"; | |
} | |
diff -r f7d31065be69 d/dmd2/identifier.c | |
--- a/d/dmd2/identifier.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/identifier.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -8,12 +8,6 @@ | |
// in artistic.txt, or the GNU General Public License in gnu.txt. | |
// See the included readme.txt for details. | |
-/* NOTE: This file has been patched from the original DMD distribution to | |
- work with the GDC compiler. | |
- | |
- Modified by David Friedman, May 2005 | |
-*/ | |
- | |
#include <stdio.h> | |
#include <string.h> | |
diff -r f7d31065be69 d/dmd2/idgen.c | |
--- a/d/dmd2/idgen.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/idgen.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -74,6 +74,8 @@ | |
{ "empty", "" }, | |
{ "p" }, | |
{ "coverage", "__coverage" }, | |
+ { "__vptr" }, | |
+ { "__monitor" }, | |
{ "TypeInfo" }, | |
{ "TypeInfo_Class" }, | |
diff -r f7d31065be69 d/dmd2/import.c | |
--- a/d/dmd2/import.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/import.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -55,7 +55,7 @@ | |
aliases.push(alias); | |
} | |
-char *Import::kind() | |
+const char *Import::kind() | |
{ | |
return isstatic ? (char *)"static import" : (char *)"import"; | |
} | |
diff -r f7d31065be69 d/dmd2/import.h | |
--- a/d/dmd2/import.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/import.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -48,7 +48,7 @@ | |
int isstatic); | |
void addAlias(Identifier *name, Identifier *alias); | |
- char *kind(); | |
+ const char *kind(); | |
Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees | |
void load(Scope *sc); | |
void semantic(Scope *sc); | |
diff -r f7d31065be69 d/dmd2/init.c | |
--- a/d/dmd2/init.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/init.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -384,7 +384,7 @@ | |
value.data[i] = (void *)val; | |
length++; | |
if (length == 0) | |
- error("array dimension overflow"); | |
+ error(loc, "array dimension overflow"); | |
if (length > dim) | |
dim = length; | |
} | |
diff -r f7d31065be69 d/dmd2/link.c | |
--- a/d/dmd2/link.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/link.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -1,6 +1,6 @@ | |
-// Copyright (c) 1999-2007 by Digital Mars | |
+// Copyright (c) 1999-2008 by Digital Mars | |
// All Rights Reserved | |
// written by Walter Bright | |
// http://www.digitalmars.com | |
@@ -35,6 +35,38 @@ | |
int executecmd(char *cmd, char *args, int useenv); | |
int executearg0(char *cmd, char *args); | |
+/**************************************** | |
+ * Write filename to cmdbuf, quoting if necessary. | |
+ */ | |
+ | |
+void writeFilename(OutBuffer *buf, char *filename, size_t len) | |
+{ | |
+ /* Loop and see if we need to quote | |
+ */ | |
+ for (size_t i = 0; i < len; i++) | |
+ { char c = filename[i]; | |
+ | |
+ if (isalnum(c) || c == '_') | |
+ continue; | |
+ | |
+ /* Need to quote | |
+ */ | |
+ buf->writeByte('"'); | |
+ buf->write(filename, len); | |
+ buf->writeByte('"'); | |
+ return; | |
+ } | |
+ | |
+ /* No quoting necessary | |
+ */ | |
+ buf->write(filename, len); | |
+} | |
+ | |
+void writeFilename(OutBuffer *buf, char *filename) | |
+{ | |
+ writeFilename(buf, filename, strlen(filename)); | |
+} | |
+ | |
/***************************** | |
* Run the linker. Return status of execution. | |
*/ | |
@@ -57,15 +89,18 @@ | |
p = (char *)global.params.objfiles->data[i]; | |
char *ext = FileName::ext(p); | |
if (ext) | |
- cmdbuf.write(p, ext - p - 1); | |
+ // Write name sans extension | |
+ writeFilename(&cmdbuf, p, ext - p - 1); | |
else | |
- cmdbuf.writestring(p); | |
+ writeFilename(&cmdbuf, p); | |
} | |
cmdbuf.writeByte(','); | |
if (global.params.exefile) | |
- cmdbuf.writestring(global.params.exefile); | |
+ writeFilename(&cmdbuf, global.params.exefile); | |
else | |
- { // Generate exe file name from first obj name | |
+ { /* Generate exe file name from first obj name. | |
+ * No need to add it to cmdbuf because the linker will default to it. | |
+ */ | |
char *n = (char *)global.params.objfiles->data[0]; | |
n = FileName::name(n); | |
FileName *fn = FileName::forceExt(n, "exe"); | |
@@ -89,13 +124,13 @@ | |
{ | |
if (i) | |
cmdbuf.writeByte('+'); | |
- cmdbuf.writestring((char *) global.params.libfiles->data[i]); | |
+ writeFilename(&cmdbuf, (char *) global.params.libfiles->data[i]); | |
} | |
if (global.params.deffile) | |
{ | |
cmdbuf.writeByte(','); | |
- cmdbuf.writestring(global.params.deffile); | |
+ writeFilename(&cmdbuf, global.params.deffile); | |
} | |
/* Eliminate unnecessary trailing commas */ | |
@@ -109,7 +144,7 @@ | |
if (global.params.resfile) | |
{ | |
cmdbuf.writestring("/RC:"); | |
- cmdbuf.writestring(global.params.resfile); | |
+ writeFilename(&cmdbuf, global.params.resfile); | |
} | |
#if 0 | |
diff -r f7d31065be69 d/dmd2/mars.c | |
--- a/d/dmd2/mars.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/mars.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -89,7 +89,7 @@ | |
copyright = "Copyright (c) 1999-2008 by Digital Mars"; | |
written = "written by Walter Bright"; | |
- version = "v2.015"; | |
+ version = "v2.016"; | |
global.structalign = 8; | |
memset(¶ms, 0, sizeof(Param)); | |
diff -r f7d31065be69 d/dmd2/mars.h | |
--- a/d/dmd2/mars.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/mars.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -307,6 +307,7 @@ | |
int runProgram(); | |
void inifile(char *argv0, char *inifile); | |
void halt(); | |
+void util_progress(); | |
/*** Where to send error messages ***/ | |
#if IN_GCC | |
diff -r f7d31065be69 d/dmd2/md5.c | |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
+++ b/d/dmd2/md5.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -0,0 +1,277 @@ | |
+/* | |
+ ********************************************************************** | |
+ ** md5.c ** | |
+ ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** | |
+ ** Created: 2/17/90 RLR ** | |
+ ** Revised: 1/91 SRD,AJ,BSK,JT Reference C Version ** | |
+ ********************************************************************** | |
+ */ | |
+ | |
+/* | |
+ ********************************************************************** | |
+ ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** | |
+ ** ** | |
+ ** License to copy and use this software is granted provided that ** | |
+ ** it is identified as the "RSA Data Security, Inc. MD5 Message ** | |
+ ** Digest Algorithm" in all material mentioning or referencing this ** | |
+ ** software or this function. ** | |
+ ** ** | |
+ ** License is also granted to make and use derivative works ** | |
+ ** provided that such works are identified as "derived from the RSA ** | |
+ ** Data Security, Inc. MD5 Message Digest Algorithm" in all ** | |
+ ** material mentioning or referencing the derived work. ** | |
+ ** ** | |
+ ** RSA Data Security, Inc. makes no representations concerning ** | |
+ ** either the merchantability of this software or the suitability ** | |
+ ** of this software for any particular purpose. It is provided "as ** | |
+ ** is" without express or implied warranty of any kind. ** | |
+ ** ** | |
+ ** These notices must be retained in any copies of any part of this ** | |
+ ** documentation and/or software. ** | |
+ ********************************************************************** | |
+ */ | |
+ | |
+/* -- include the following line if the md5.h header file is separate -- */ | |
+#include "md5.h" | |
+ | |
+/* forward declaration */ | |
+static void Transform (UINT4 *buf, UINT4 *in); | |
+ | |
+static unsigned char PADDING[64] = { | |
+ 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | |
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 | |
+}; | |
+ | |
+/* F, G and H are basic MD5 functions: selection, majority, parity */ | |
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) | |
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) | |
+#define H(x, y, z) ((x) ^ (y) ^ (z)) | |
+#define I(x, y, z) ((y) ^ ((x) | (~z))) | |
+ | |
+/* ROTATE_LEFT rotates x left n bits */ | |
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) | |
+ | |
+/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4 */ | |
+/* Rotation is separate from addition to prevent recomputation */ | |
+#define FF(a, b, c, d, x, s, ac) \ | |
+ {(a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ | |
+ (a) = ROTATE_LEFT ((a), (s)); \ | |
+ (a) += (b); \ | |
+ } | |
+#define GG(a, b, c, d, x, s, ac) \ | |
+ {(a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ | |
+ (a) = ROTATE_LEFT ((a), (s)); \ | |
+ (a) += (b); \ | |
+ } | |
+#define HH(a, b, c, d, x, s, ac) \ | |
+ {(a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ | |
+ (a) = ROTATE_LEFT ((a), (s)); \ | |
+ (a) += (b); \ | |
+ } | |
+#define II(a, b, c, d, x, s, ac) \ | |
+ {(a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ | |
+ (a) = ROTATE_LEFT ((a), (s)); \ | |
+ (a) += (b); \ | |
+ } | |
+ | |
+void MD5Init (mdContext) | |
+MD5_CTX *mdContext; | |
+{ | |
+ mdContext->i[0] = mdContext->i[1] = (UINT4)0; | |
+ | |
+ /* Load magic initialization constants. | |
+ */ | |
+ mdContext->buf[0] = (UINT4)0x67452301; | |
+ mdContext->buf[1] = (UINT4)0xefcdab89; | |
+ mdContext->buf[2] = (UINT4)0x98badcfe; | |
+ mdContext->buf[3] = (UINT4)0x10325476; | |
+} | |
+ | |
+void MD5Update (mdContext, inBuf, inLen) | |
+MD5_CTX *mdContext; | |
+unsigned char *inBuf; | |
+unsigned int inLen; | |
+{ | |
+ UINT4 in[16]; | |
+ int mdi; | |
+ unsigned int i, ii; | |
+ | |
+ /* compute number of bytes mod 64 */ | |
+ mdi = (int)((mdContext->i[0] >> 3) & 0x3F); | |
+ | |
+ /* update number of bits */ | |
+ if ((mdContext->i[0] + ((UINT4)inLen << 3)) < mdContext->i[0]) | |
+ mdContext->i[1]++; | |
+ mdContext->i[0] += ((UINT4)inLen << 3); | |
+ mdContext->i[1] += ((UINT4)inLen >> 29); | |
+ | |
+ while (inLen--) { | |
+ /* add new character to buffer, increment mdi */ | |
+ mdContext->in[mdi++] = *inBuf++; | |
+ | |
+ /* transform if necessary */ | |
+ if (mdi == 0x40) { | |
+ for (i = 0, ii = 0; i < 16; i++, ii += 4) | |
+ in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | | |
+ (((UINT4)mdContext->in[ii+2]) << 16) | | |
+ (((UINT4)mdContext->in[ii+1]) << 8) | | |
+ ((UINT4)mdContext->in[ii]); | |
+ Transform (mdContext->buf, in); | |
+ mdi = 0; | |
+ } | |
+ } | |
+} | |
+ | |
+void MD5Final (mdContext) | |
+MD5_CTX *mdContext; | |
+{ | |
+ UINT4 in[16]; | |
+ int mdi; | |
+ unsigned int i, ii; | |
+ unsigned int padLen; | |
+ | |
+ /* save number of bits */ | |
+ in[14] = mdContext->i[0]; | |
+ in[15] = mdContext->i[1]; | |
+ | |
+ /* compute number of bytes mod 64 */ | |
+ mdi = (int)((mdContext->i[0] >> 3) & 0x3F); | |
+ | |
+ /* pad out to 56 mod 64 */ | |
+ padLen = (mdi < 56) ? (56 - mdi) : (120 - mdi); | |
+ MD5Update (mdContext, PADDING, padLen); | |
+ | |
+ /* append length in bits and transform */ | |
+ for (i = 0, ii = 0; i < 14; i++, ii += 4) | |
+ in[i] = (((UINT4)mdContext->in[ii+3]) << 24) | | |
+ (((UINT4)mdContext->in[ii+2]) << 16) | | |
+ (((UINT4)mdContext->in[ii+1]) << 8) | | |
+ ((UINT4)mdContext->in[ii]); | |
+ Transform (mdContext->buf, in); | |
+ | |
+ /* store buffer in digest */ | |
+ for (i = 0, ii = 0; i < 4; i++, ii += 4) { | |
+ mdContext->digest[ii] = (unsigned char)(mdContext->buf[i] & 0xFF); | |
+ mdContext->digest[ii+1] = | |
+ (unsigned char)((mdContext->buf[i] >> 8) & 0xFF); | |
+ mdContext->digest[ii+2] = | |
+ (unsigned char)((mdContext->buf[i] >> 16) & 0xFF); | |
+ mdContext->digest[ii+3] = | |
+ (unsigned char)((mdContext->buf[i] >> 24) & 0xFF); | |
+ } | |
+} | |
+ | |
+/* Basic MD5 step. Transform buf based on in. | |
+ */ | |
+static void Transform (buf, in) | |
+UINT4 *buf; | |
+UINT4 *in; | |
+{ | |
+ UINT4 a = buf[0], b = buf[1], c = buf[2], d = buf[3]; | |
+ | |
+ /* Round 1 */ | |
+#define S11 7 | |
+#define S12 12 | |
+#define S13 17 | |
+#define S14 22 | |
+ FF ( a, b, c, d, in[ 0], S11, 3614090360); /* 1 */ | |
+ FF ( d, a, b, c, in[ 1], S12, 3905402710); /* 2 */ | |
+ FF ( c, d, a, b, in[ 2], S13, 606105819); /* 3 */ | |
+ FF ( b, c, d, a, in[ 3], S14, 3250441966); /* 4 */ | |
+ FF ( a, b, c, d, in[ 4], S11, 4118548399); /* 5 */ | |
+ FF ( d, a, b, c, in[ 5], S12, 1200080426); /* 6 */ | |
+ FF ( c, d, a, b, in[ 6], S13, 2821735955); /* 7 */ | |
+ FF ( b, c, d, a, in[ 7], S14, 4249261313); /* 8 */ | |
+ FF ( a, b, c, d, in[ 8], S11, 1770035416); /* 9 */ | |
+ FF ( d, a, b, c, in[ 9], S12, 2336552879); /* 10 */ | |
+ FF ( c, d, a, b, in[10], S13, 4294925233); /* 11 */ | |
+ FF ( b, c, d, a, in[11], S14, 2304563134); /* 12 */ | |
+ FF ( a, b, c, d, in[12], S11, 1804603682); /* 13 */ | |
+ FF ( d, a, b, c, in[13], S12, 4254626195); /* 14 */ | |
+ FF ( c, d, a, b, in[14], S13, 2792965006); /* 15 */ | |
+ FF ( b, c, d, a, in[15], S14, 1236535329); /* 16 */ | |
+ | |
+ /* Round 2 */ | |
+#define S21 5 | |
+#define S22 9 | |
+#define S23 14 | |
+#define S24 20 | |
+ GG ( a, b, c, d, in[ 1], S21, 4129170786); /* 17 */ | |
+ GG ( d, a, b, c, in[ 6], S22, 3225465664); /* 18 */ | |
+ GG ( c, d, a, b, in[11], S23, 643717713); /* 19 */ | |
+ GG ( b, c, d, a, in[ 0], S24, 3921069994); /* 20 */ | |
+ GG ( a, b, c, d, in[ 5], S21, 3593408605); /* 21 */ | |
+ GG ( d, a, b, c, in[10], S22, 38016083); /* 22 */ | |
+ GG ( c, d, a, b, in[15], S23, 3634488961); /* 23 */ | |
+ GG ( b, c, d, a, in[ 4], S24, 3889429448); /* 24 */ | |
+ GG ( a, b, c, d, in[ 9], S21, 568446438); /* 25 */ | |
+ GG ( d, a, b, c, in[14], S22, 3275163606); /* 26 */ | |
+ GG ( c, d, a, b, in[ 3], S23, 4107603335); /* 27 */ | |
+ GG ( b, c, d, a, in[ 8], S24, 1163531501); /* 28 */ | |
+ GG ( a, b, c, d, in[13], S21, 2850285829); /* 29 */ | |
+ GG ( d, a, b, c, in[ 2], S22, 4243563512); /* 30 */ | |
+ GG ( c, d, a, b, in[ 7], S23, 1735328473); /* 31 */ | |
+ GG ( b, c, d, a, in[12], S24, 2368359562); /* 32 */ | |
+ | |
+ /* Round 3 */ | |
+#define S31 4 | |
+#define S32 11 | |
+#define S33 16 | |
+#define S34 23 | |
+ HH ( a, b, c, d, in[ 5], S31, 4294588738); /* 33 */ | |
+ HH ( d, a, b, c, in[ 8], S32, 2272392833); /* 34 */ | |
+ HH ( c, d, a, b, in[11], S33, 1839030562); /* 35 */ | |
+ HH ( b, c, d, a, in[14], S34, 4259657740); /* 36 */ | |
+ HH ( a, b, c, d, in[ 1], S31, 2763975236); /* 37 */ | |
+ HH ( d, a, b, c, in[ 4], S32, 1272893353); /* 38 */ | |
+ HH ( c, d, a, b, in[ 7], S33, 4139469664); /* 39 */ | |
+ HH ( b, c, d, a, in[10], S34, 3200236656); /* 40 */ | |
+ HH ( a, b, c, d, in[13], S31, 681279174); /* 41 */ | |
+ HH ( d, a, b, c, in[ 0], S32, 3936430074); /* 42 */ | |
+ HH ( c, d, a, b, in[ 3], S33, 3572445317); /* 43 */ | |
+ HH ( b, c, d, a, in[ 6], S34, 76029189); /* 44 */ | |
+ HH ( a, b, c, d, in[ 9], S31, 3654602809); /* 45 */ | |
+ HH ( d, a, b, c, in[12], S32, 3873151461); /* 46 */ | |
+ HH ( c, d, a, b, in[15], S33, 530742520); /* 47 */ | |
+ HH ( b, c, d, a, in[ 2], S34, 3299628645); /* 48 */ | |
+ | |
+ /* Round 4 */ | |
+#define S41 6 | |
+#define S42 10 | |
+#define S43 15 | |
+#define S44 21 | |
+ II ( a, b, c, d, in[ 0], S41, 4096336452); /* 49 */ | |
+ II ( d, a, b, c, in[ 7], S42, 1126891415); /* 50 */ | |
+ II ( c, d, a, b, in[14], S43, 2878612391); /* 51 */ | |
+ II ( b, c, d, a, in[ 5], S44, 4237533241); /* 52 */ | |
+ II ( a, b, c, d, in[12], S41, 1700485571); /* 53 */ | |
+ II ( d, a, b, c, in[ 3], S42, 2399980690); /* 54 */ | |
+ II ( c, d, a, b, in[10], S43, 4293915773); /* 55 */ | |
+ II ( b, c, d, a, in[ 1], S44, 2240044497); /* 56 */ | |
+ II ( a, b, c, d, in[ 8], S41, 1873313359); /* 57 */ | |
+ II ( d, a, b, c, in[15], S42, 4264355552); /* 58 */ | |
+ II ( c, d, a, b, in[ 6], S43, 2734768916); /* 59 */ | |
+ II ( b, c, d, a, in[13], S44, 1309151649); /* 60 */ | |
+ II ( a, b, c, d, in[ 4], S41, 4149444226); /* 61 */ | |
+ II ( d, a, b, c, in[11], S42, 3174756917); /* 62 */ | |
+ II ( c, d, a, b, in[ 2], S43, 718787259); /* 63 */ | |
+ II ( b, c, d, a, in[ 9], S44, 3951481745); /* 64 */ | |
+ | |
+ buf[0] += a; | |
+ buf[1] += b; | |
+ buf[2] += c; | |
+ buf[3] += d; | |
+} | |
+ | |
+/* | |
+ ********************************************************************** | |
+ ** End of md5.c ** | |
+ ******************************* (cut) ******************************** | |
+ */ | |
+ | |
diff -r f7d31065be69 d/dmd2/md5.h | |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 | |
+++ b/d/dmd2/md5.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -0,0 +1,61 @@ | |
+/* | |
+ ********************************************************************** | |
+ ** md5.h -- Header file for implementation of MD5 ** | |
+ ** RSA Data Security, Inc. MD5 Message Digest Algorithm ** | |
+ ** Created: 2/17/90 RLR ** | |
+ ** Revised: 12/27/90 SRD,AJ,BSK,JT Reference C version ** | |
+ ** Revised (for MD5): RLR 4/27/91 ** | |
+ ** -- G modified to have y&~z instead of y&z ** | |
+ ** -- FF, GG, HH modified to add in last register done ** | |
+ ** -- Access pattern: round 2 works mod 5, round 3 works mod 3 ** | |
+ ** -- distinct additive constant for each step ** | |
+ ** -- round 4 added, working mod 7 ** | |
+ ********************************************************************** | |
+ */ | |
+ | |
+/* | |
+ ********************************************************************** | |
+ ** Copyright (C) 1990, RSA Data Security, Inc. All rights reserved. ** | |
+ ** ** | |
+ ** License to copy and use this software is granted provided that ** | |
+ ** it is identified as the "RSA Data Security, Inc. MD5 Message ** | |
+ ** Digest Algorithm" in all material mentioning or referencing this ** | |
+ ** software or this function. ** | |
+ ** ** | |
+ ** License is also granted to make and use derivative works ** | |
+ ** provided that such works are identified as "derived from the RSA ** | |
+ ** Data Security, Inc. MD5 Message Digest Algorithm" in all ** | |
+ ** material mentioning or referencing the derived work. ** | |
+ ** ** | |
+ ** RSA Data Security, Inc. makes no representations concerning ** | |
+ ** either the merchantability of this software or the suitability ** | |
+ ** of this software for any particular purpose. It is provided "as ** | |
+ ** is" without express or implied warranty of any kind. ** | |
+ ** ** | |
+ ** These notices must be retained in any copies of any part of this ** | |
+ ** documentation and/or software. ** | |
+ ********************************************************************** | |
+ */ | |
+ | |
+/* typedef a 32 bit type */ | |
+typedef unsigned long int UINT4; | |
+ | |
+/* Data structure for MD5 (Message Digest) computation */ | |
+typedef struct { | |
+ UINT4 i[2]; /* number of _bits_ handled mod 2^64 */ | |
+ UINT4 buf[4]; /* scratch buffer */ | |
+ unsigned char in[64]; /* input buffer */ | |
+ unsigned char digest[16]; /* actual digest after MD5Final call */ | |
+} MD5_CTX; | |
+ | |
+void MD5Init (MD5_CTX *mdContext); | |
+void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned inLen); | |
+void MD5Final (MD5_CTX *mdContext); | |
+ | |
+/* | |
+ ********************************************************************** | |
+ ** End of md5.h ** | |
+ ******************************* (cut) ******************************** | |
+ */ | |
+ | |
+ | |
diff -r f7d31065be69 d/dmd2/module.c | |
--- a/d/dmd2/module.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/module.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -228,7 +228,7 @@ | |
{ | |
} | |
-char *Module::kind() | |
+const char *Module::kind() | |
{ | |
return "module"; | |
} | |
@@ -943,7 +943,7 @@ | |
} | |
-char *Package::kind() | |
+const char *Package::kind() | |
{ | |
return "package"; | |
} | |
diff -r f7d31065be69 d/dmd2/module.h | |
--- a/d/dmd2/module.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/module.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -36,7 +36,7 @@ | |
struct Package : ScopeDsymbol | |
{ | |
Package(Identifier *ident); | |
- char *kind(); | |
+ const char *kind(); | |
static DsymbolTable *resolve(Array *packages, Dsymbol **pparent, Package **ppkg); | |
@@ -110,7 +110,7 @@ | |
static Module *load(Loc loc, Array *packages, Identifier *ident); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
void setDocfile(); // set docfile member | |
void read(Loc loc); // read file | |
#if IN_GCC | |
diff -r f7d31065be69 d/dmd2/mtype.c | |
--- a/d/dmd2/mtype.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/mtype.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -3033,7 +3033,7 @@ | |
#if 0 | |
printf("Type::covariant(t = %s) %s\n", t->toChars(), toChars()); | |
printf("deco = %p, %p\n", deco, t->deco); | |
- //printf("ty = %d\n", next->ty); | |
+// printf("ty = %d\n", next->ty); | |
#endif | |
int inoutmismatch = 0; | |
@@ -3749,6 +3749,7 @@ | |
if (s) | |
{ | |
//printf("\t1: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind()); | |
+ s->checkDeprecated(loc, sc); // check for deprecated aliases | |
s = s->toAlias(); | |
//printf("\t2: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind()); | |
for (int i = 0; i < idents.dim; i++) | |
@@ -4248,6 +4249,10 @@ | |
sc->intypeof++; | |
exp = exp->semantic(sc); | |
sc->intypeof--; | |
+ if (exp->op == TOKtype) | |
+ { | |
+ error(loc, "argument %s to typeof is not an expression", exp->toChars()); | |
+ } | |
t = exp->type; | |
if (!t) | |
{ | |
@@ -4977,6 +4982,7 @@ | |
} | |
return Type::dotExp(sc, e, ident); | |
} | |
+ s->checkDeprecated(e->loc, sc); | |
s = s->toAlias(); | |
v = s->isVarDeclaration(); | |
@@ -5411,6 +5417,7 @@ | |
return Type::dotExp(sc, e, ident); | |
} | |
} | |
+ s->checkDeprecated(e->loc, sc); | |
s = s->toAlias(); | |
v = s->isVarDeclaration(); | |
if (v && !v->isDataseg()) | |
diff -r f7d31065be69 d/dmd2/parse.c | |
--- a/d/dmd2/parse.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/parse.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -889,7 +889,7 @@ | |
/***************************************** | |
* Parse an invariant definition: | |
- * invariant { body } | |
+ * invariant() { body } | |
* Current token is 'invariant'. | |
*/ | |
@@ -1635,9 +1635,10 @@ | |
if (token.value != TOKidentifier) | |
{ | |
error("identifier expected, not %s", token.toChars()); | |
- goto Lerr; | |
- } | |
- id = token.ident; | |
+ id = Id::empty; | |
+ } | |
+ else | |
+ id = token.ident; | |
nextToken(); | |
} | |
@@ -1686,9 +1687,6 @@ | |
nextToken(); | |
return tm; | |
- | |
-Lerr: | |
- return NULL; | |
} | |
/****************************************** | |
@@ -4546,8 +4544,6 @@ | |
case TOKtypeof: | |
{ | |
t = parseTypeof(); | |
- if (token.value == TOKdot) | |
- goto L1; | |
e = new TypeExp(loc, t); | |
break; | |
} | |
diff -r f7d31065be69 d/dmd2/statement.c | |
--- a/d/dmd2/statement.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/statement.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -304,15 +304,14 @@ | |
} | |
Statement *CompileStatement::semantic(Scope *sc) | |
- { | |
- //printf("CompileStatement::semantic() %s\n", exp->toChars()); | |
- /* Shouldn't happen unless errors, as CompileStatement::flatten() | |
- * should have replaced it. | |
- * Return NULL so no further errors happen. | |
- */ | |
- assert(global.errors); | |
- return NULL; | |
- } | |
+{ | |
+ //printf("CompileStatement::semantic() %s\n", exp->toChars()); | |
+ Statements *a = flatten(sc); | |
+ if (!a) | |
+ return NULL; | |
+ Statement *s = new CompoundStatement(loc, a); | |
+ return s->semantic(sc); | |
+} | |
/******************************** DeclarationStatement ***************************/ | |
@@ -590,7 +589,7 @@ | |
int CompoundStatement::fallOffEnd() | |
{ int falloff = TRUE; | |
- //printf("CompoundStatement::fallOffEnd()\n"); | |
+ //printf("CompoundStatement::fallOffEnd() %s\n", toChars()); | |
for (int i = 0; i < statements->dim; i++) | |
{ Statement *s = (Statement *)statements->data[i]; | |
@@ -933,14 +932,25 @@ | |
int result = BEnone; | |
if (condition->canThrow()) | |
result |= BEthrow; | |
- if (body) | |
- { result |= body->blockExit(); | |
- if (result & BEbreak) | |
- result |= BEfallthru; | |
- result &= ~(BEbreak | BEcontinue); | |
- } | |
- else | |
+ if (condition->isBool(TRUE)) | |
+ { | |
+ if (body) | |
+ { result |= body->blockExit(); | |
+ if (result & BEbreak) | |
+ result |= BEfallthru; | |
+ } | |
+ } | |
+ else if (condition->isBool(FALSE)) | |
+ { | |
result |= BEfallthru; | |
+ } | |
+ else | |
+ { | |
+ if (body) | |
+ result |= body->blockExit(); | |
+ result |= BEfallthru; | |
+ } | |
+ result &= ~(BEbreak | BEcontinue); | |
return result; | |
} | |
@@ -1019,20 +1029,20 @@ | |
if (body) | |
{ result = body->blockExit(); | |
- if (result & BEbreak) | |
- { | |
- if (result == BEbreak) | |
- return BEfallthru; | |
- result |= BEfallthru; | |
- } | |
+ if (result == BEbreak) | |
+ return BEfallthru; | |
if (result & BEcontinue) | |
result |= BEfallthru; | |
- result &= ~(BEbreak | BEcontinue); | |
} | |
else | |
result = BEfallthru; | |
- if (result & BEfallthru && condition->canThrow()) | |
- result |= BEthrow; | |
+ if (result & BEfallthru) | |
+ { if (condition->canThrow()) | |
+ result |= BEthrow; | |
+ if (!(result & BEbreak) && condition->isBool(TRUE)) | |
+ result &= ~BEfallthru; | |
+ } | |
+ result &= ~(BEbreak | BEcontinue); | |
return result; | |
} | |
@@ -2045,14 +2055,31 @@ | |
int result = BEnone; | |
if (condition->canThrow()) | |
result |= BEthrow; | |
- if (ifbody) | |
- result |= ifbody->blockExit(); | |
- else | |
- result |= BEfallthru; | |
- if (elsebody) | |
- result |= elsebody->blockExit(); | |
- else | |
- result |= BEfallthru; | |
+ if (condition->isBool(TRUE)) | |
+ { | |
+ if (ifbody) | |
+ result |= ifbody->blockExit(); | |
+ else | |
+ result |= BEfallthru; | |
+ } | |
+ else if (condition->isBool(FALSE)) | |
+ { | |
+ if (elsebody) | |
+ result |= elsebody->blockExit(); | |
+ else | |
+ result |= BEfallthru; | |
+ } | |
+ else | |
+ { | |
+ if (ifbody) | |
+ result |= ifbody->blockExit(); | |
+ else | |
+ result |= BEfallthru; | |
+ if (elsebody) | |
+ result |= elsebody->blockExit(); | |
+ else | |
+ result |= BEfallthru; | |
+ } | |
//printf("IfStatement::blockExit(%p) = x%x\n", this, result); | |
return result; | |
} | |
@@ -2621,8 +2648,7 @@ | |
int CaseStatement::blockExit() | |
{ | |
- // Assume the worst | |
- return BEany; | |
+ return statement->blockExit(); | |
} | |
int CaseStatement::fallOffEnd() | |
@@ -2688,8 +2714,7 @@ | |
int DefaultStatement::blockExit() | |
{ | |
- // Assume the worst | |
- return BEany; | |
+ return statement->blockExit(); | |
} | |
int DefaultStatement::fallOffEnd() | |
diff -r f7d31065be69 d/dmd2/statement.h | |
--- a/d/dmd2/statement.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/statement.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -340,6 +340,7 @@ | |
void toIR(IRState *irs); | |
}; | |
+#if V2 | |
struct ForeachRangeStatement : Statement | |
{ | |
enum TOK op; // TOKforeach or TOKforeach_reverse | |
@@ -367,6 +368,7 @@ | |
void toIR(IRState *irs); | |
}; | |
+#endif | |
struct IfStatement : Statement | |
{ | |
diff -r f7d31065be69 d/dmd2/staticassert.c | |
--- a/d/dmd2/staticassert.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/staticassert.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -90,7 +90,7 @@ | |
{ | |
} | |
-char *StaticAssert::kind() | |
+const char *StaticAssert::kind() | |
{ | |
return "static assert"; | |
} | |
diff -r f7d31065be69 d/dmd2/staticassert.h | |
--- a/d/dmd2/staticassert.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/staticassert.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -36,7 +36,7 @@ | |
void inlineScan(); | |
int oneMember(Dsymbol **ps); | |
void toObjFile(int multiobj); | |
- char *kind(); | |
+ const char *kind(); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
}; | |
diff -r f7d31065be69 d/dmd2/struct.c | |
--- a/d/dmd2/struct.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/struct.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -276,6 +276,8 @@ | |
structalign = sc->structalign; | |
protection = sc->protection; | |
storage_class |= sc->stc; | |
+ if (sc->stc & STCdeprecated) | |
+ isdeprecated = 1; | |
assert(!isAnonymous()); | |
if (sc->stc & STCabstract) | |
error("structs, unions cannot be abstract"); | |
@@ -485,7 +487,7 @@ | |
} | |
-char *StructDeclaration::kind() | |
+const char *StructDeclaration::kind() | |
{ | |
return "struct"; | |
} | |
@@ -510,7 +512,7 @@ | |
} | |
-char *UnionDeclaration::kind() | |
+const char *UnionDeclaration::kind() | |
{ | |
return "union"; | |
} | |
diff -r f7d31065be69 d/dmd2/template.c | |
--- a/d/dmd2/template.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/template.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -300,7 +300,7 @@ | |
if (ttp) | |
{ | |
- printf("\tparameter[%d] = %s : %s\n", i, tp->ident->toChars(), ttp->specType ? ttp->specType->toChars() : ""); | |
+ printf("\tparameter[%d] = %s : %s\n", i, tp->ident->toChars(), ttp->specType ? ttp->specType->toChars() : ""); | |
} | |
} | |
#endif | |
@@ -426,7 +426,7 @@ | |
*/ | |
} | |
-char *TemplateDeclaration::kind() | |
+const char *TemplateDeclaration::kind() | |
{ | |
return (onemember && onemember->isAggregateDeclaration()) | |
? onemember->kind() | |
@@ -593,21 +593,21 @@ | |
} | |
} | |
- if (m && constraint && !(flag & 1)) | |
- { /* Check to see if constraint is satisfied. | |
- */ | |
- Expression *e = constraint->syntaxCopy(); | |
- paramscope->flags |= SCOPEstaticif; | |
- e = e->semantic(paramscope); | |
- e = e->optimize(WANTvalue | WANTinterpret); | |
- if (e->isBool(TRUE)) | |
- ; | |
- else if (e->isBool(FALSE)) | |
- goto Lnomatch; | |
- else | |
- { | |
- e->error("constraint %s is not constant or does not evaluate to a bool", e->toChars()); | |
- } | |
+ if (m && constraint && !(flag & 1)) | |
+ { /* Check to see if constraint is satisfied. | |
+ */ | |
+ Expression *e = constraint->syntaxCopy(); | |
+ paramscope->flags |= SCOPEstaticif; | |
+ e = e->semantic(paramscope); | |
+ e = e->optimize(WANTvalue | WANTinterpret); | |
+ if (e->isBool(TRUE)) | |
+ ; | |
+ else if (e->isBool(FALSE)) | |
+ goto Lnomatch; | |
+ else | |
+ { | |
+ e->error("constraint %s is not constant or does not evaluate to a bool", e->toChars()); | |
+ } | |
} | |
#if LOGM | |
@@ -946,13 +946,6 @@ | |
//printf("\tm2 = %d\n", m); | |
} | |
- /* If no match, see if we can implicitly convert farg to the | |
- * parameter type. | |
- */ | |
- if (!m) | |
- { m = farg->implicitConvTo(fparam->type); | |
- } | |
- | |
if (m) | |
{ if (m < match) | |
match = m; // pick worst match | |
@@ -1068,23 +1061,23 @@ | |
dedargs->data[i] = (void *)oded; | |
} | |
} | |
- if (constraint) | |
- { /* Check to see if constraint is satisfied. | |
- */ | |
- Expression *e = constraint->syntaxCopy(); | |
- paramscope->flags |= SCOPEstaticif; | |
- e = e->semantic(paramscope); | |
- e = e->optimize(WANTvalue | WANTinterpret); | |
- if (e->isBool(TRUE)) | |
- ; | |
- else if (e->isBool(FALSE)) | |
- goto Lnomatch; | |
- else | |
- { | |
- e->error("constraint %s is not constant or does not evaluate to a bool", e->toChars()); | |
- } | |
- } | |
- | |
+ if (constraint) | |
+ { /* Check to see if constraint is satisfied. | |
+ */ | |
+ Expression *e = constraint->syntaxCopy(); | |
+ paramscope->flags |= SCOPEstaticif; | |
+ e = e->semantic(paramscope); | |
+ e = e->optimize(WANTvalue | WANTinterpret); | |
+ if (e->isBool(TRUE)) | |
+ ; | |
+ else if (e->isBool(FALSE)) | |
+ goto Lnomatch; | |
+ else | |
+ { | |
+ e->error("constraint %s is not constant or does not evaluate to a bool", e->toChars()); | |
+ } | |
+ } | |
+ | |
#if 0 | |
for (i = 0; i < dedargs->dim; i++) | |
@@ -1351,12 +1344,12 @@ | |
} | |
buf->writeByte(')'); | |
- if (constraint) | |
- { buf->writestring(" if ("); | |
- constraint->toCBuffer(buf, hgs); | |
- buf->writeByte(')'); | |
- } | |
- | |
+ if (constraint) | |
+ { buf->writestring(" if ("); | |
+ constraint->toCBuffer(buf, hgs); | |
+ buf->writeByte(')'); | |
+ } | |
+ | |
if (hgs->hdrgen) | |
{ | |
hgs->tpltMember++; | |
@@ -1390,13 +1383,13 @@ | |
tp->toCBuffer(&buf, &hgs); | |
} | |
buf.writeByte(')'); | |
- | |
- if (constraint) | |
- { buf.writestring(" if ("); | |
- constraint->toCBuffer(&buf, &hgs); | |
- buf.writeByte(')'); | |
- } | |
- | |
+ | |
+ if (constraint) | |
+ { buf.writestring(" if ("); | |
+ constraint->toCBuffer(&buf, &hgs); | |
+ buf.writeByte(')'); | |
+ } | |
+ | |
buf.writeByte(0); | |
return (char *)buf.extractData(); | |
} | |
@@ -1466,10 +1459,20 @@ | |
{ | |
if (!sc) | |
goto Lnomatch; | |
+ | |
+ /* Need a loc to go with the semantic routine. | |
+ */ | |
+ Loc loc; | |
+ if (parameters->dim) | |
+ { | |
+ TemplateParameter *tp = (TemplateParameter *)parameters->data[0]; | |
+ loc = tp->loc; | |
+ } | |
+ | |
/* BUG: what if tparam is a template instance, that | |
* has as an argument another Tident? | |
*/ | |
- tparam = tparam->semantic(0, sc); | |
+ tparam = tparam->semantic(loc, sc); | |
assert(tparam->ty != Tident); | |
return deduceType(sc, tparam, parameters, dedtypes); | |
} | |
@@ -1523,7 +1526,8 @@ | |
} | |
if (ty != tparam->ty) | |
- goto Lnomatch; | |
+ return implicitConvTo(tparam); | |
+// goto Lnomatch; | |
if (nextOf()) | |
return nextOf()->deduceType(sc, tparam->nextOf(), parameters, dedtypes); | |
@@ -2984,7 +2988,7 @@ | |
printf("TemplateInstance(this = %p, ident = '%s')\n", this, ident ? ident->toChars() : "null"); | |
#endif | |
this->loc = loc; | |
- this->name = ident; | |
+ this->name = ident; | |
this->tiargs = NULL; | |
this->tempdecl = NULL; | |
this->inst = NULL; | |
@@ -3011,7 +3015,7 @@ | |
: ScopeDsymbol(NULL) | |
{ | |
#if LOG | |
- printf("TemplateInstance(this = %p, tempdecl = '%s')\n", this, td->toChars()); | |
+ printf("TemplateInstance(this = %p, tempdecl = '%s')\n", this, td->toChars()); | |
#endif | |
this->loc = loc; | |
this->name = td->ident; | |
@@ -3359,7 +3363,7 @@ | |
Dsymbol *s = (Dsymbol *)members->data[i]; | |
//printf("\t[%d] semantic on '%s' %p kind %s in '%s'\n", i, s->toChars(), s, s->kind(), this->toChars()); | |
//printf("test: isnested = %d, sc2->parent = %s\n", isnested, sc2->parent->toChars()); | |
-// if (isnested) | |
+// if (isnested) | |
// s->parent = sc->parent; | |
//printf("test3: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars()); | |
s->semantic(sc2); | |
@@ -3660,7 +3664,7 @@ | |
Objects dedtypes; | |
#if LOG | |
- printf("TemplateInstance::findBestMatch()\n"); | |
+ printf("TemplateInstance::findBestMatch()\n"); | |
#endif | |
for (TemplateDeclaration *td = tempdecl; td; td = td->overnext) | |
{ | |
@@ -3684,7 +3688,7 @@ | |
return NULL; | |
} | |
m = td->matchWithInstance(this, &dedtypes, 0); | |
- //printf("m = %d\n", m); | |
+ //printf("matchWithInstance = %d\n", m); | |
if (!m) // no match at all | |
continue; | |
@@ -3877,7 +3881,7 @@ | |
buf.writeByte('T'); | |
if (ta->deco) | |
buf.writestring(ta->deco); | |
- else | |
+ else | |
{ | |
#ifdef DEBUG | |
printf("ta = %d, %s\n", ta->ty, ta->toChars()); | |
@@ -4125,7 +4129,7 @@ | |
return aliasdecl; | |
} | |
-char *TemplateInstance::kind() | |
+const char *TemplateInstance::kind() | |
{ | |
return "template instance"; | |
} | |
@@ -4208,6 +4212,7 @@ | |
#if LOG | |
printf("\tdo semantic\n"); | |
#endif | |
+ //util_progress(); | |
Scope *scx = NULL; | |
if (scope) | |
@@ -4322,6 +4327,11 @@ | |
if (!tm || tempdecl != tm->tempdecl) | |
continue; | |
+ /* Different argument list lengths happen with variadic args | |
+ */ | |
+ if (tiargs->dim != tm->tiargs->dim) | |
+ continue; | |
+ | |
for (int i = 0; i < tiargs->dim; i++) | |
{ Object *o = (Object *)tiargs->data[i]; | |
Type *ta = isType(o); | |
@@ -4505,7 +4515,7 @@ | |
TemplateInstance::inlineScan(); | |
} | |
-char *TemplateMixin::kind() | |
+const char *TemplateMixin::kind() | |
{ | |
return "mixin"; | |
} | |
@@ -4513,7 +4523,7 @@ | |
int TemplateMixin::oneMember(Dsymbol **ps) | |
{ | |
return Dsymbol::oneMember(ps); | |
-} | |
+} | |
int TemplateMixin::hasPointers() | |
{ | |
diff -r f7d31065be69 d/dmd2/template.h | |
--- a/d/dmd2/template.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/template.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -52,8 +52,8 @@ | |
TemplateParameters *origParameters; // originals for Ddoc | |
- Expression *constraint; | |
- | |
+ Expression *constraint; | |
+ | |
Array instances; // array of TemplateInstance's | |
TemplateDeclaration *overnext; // next overloaded TemplateDeclaration | |
@@ -63,12 +63,12 @@ | |
Dsymbol *onemember; // if !=NULL then one member of this template | |
TemplateDeclaration(Loc loc, Identifier *id, TemplateParameters *parameters, | |
- Expression *constraint, Array *decldefs); | |
+ Expression *constraint, Array *decldefs); | |
Dsymbol *syntaxCopy(Dsymbol *); | |
void semantic(Scope *sc); | |
int overloadInsert(Dsymbol *s); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
char *toChars(); | |
void emitComment(Scope *sc); | |
@@ -273,7 +273,7 @@ | |
// sole member | |
WithScopeSymbol *withsym; // if a member of a with statement | |
int semanticdone; // has semantic() been done? | |
- int semantictiargsdone; // has semanticTiargs() been done? | |
+ int semantictiargsdone; // has semanticTiargs() been done? | |
int nest; // for recursion detection | |
int havetempdecl; // 1 if used second constructor | |
Dsymbol *isnested; // if referencing local symbols, this is the context | |
@@ -295,7 +295,7 @@ | |
void inlineScan(); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
Dsymbol *toAlias(); // resolve real symbol | |
- char *kind(); | |
+ const char *kind(); | |
int oneMember(Dsymbol **ps); | |
char *toChars(); | |
char *mangle(); | |
@@ -328,7 +328,7 @@ | |
void semantic2(Scope *sc); | |
void semantic3(Scope *sc); | |
void inlineScan(); | |
- char *kind(); | |
+ const char *kind(); | |
int oneMember(Dsymbol **ps); | |
int hasPointers(); | |
char *toChars(); | |
diff -r f7d31065be69 d/dmd2/tocsym.c | |
--- a/d/dmd2/tocsym.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/tocsym.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -189,7 +189,7 @@ | |
t = type_fake(TYnptr); | |
} | |
else if (storage_class & STClazy) | |
- t = type_fake(TYullong); // Tdelegate as C type | |
+ t = type_fake(TYdelegate); // Tdelegate as C type | |
else if (isParameter()) | |
t = type->toCParamtype(); | |
else | |
diff -r f7d31065be69 d/dmd2/toir.c | |
--- a/d/dmd2/toir.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/toir.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -442,9 +442,24 @@ | |
/* Align and allocate space for v in the closure | |
* just like AggregateDeclaration::addField() does. | |
*/ | |
- unsigned memsize = v->type->size(); | |
- unsigned memalignsize = v->type->alignsize(); | |
- unsigned xalign = v->type->memalign(global.structalign); | |
+ unsigned memsize; | |
+ unsigned memalignsize; | |
+ unsigned xalign; | |
+ if (v->storage_class & STClazy) | |
+ { | |
+ /* Lazy variables are really delegates, | |
+ * so give same answers that TypeDelegate would | |
+ */ | |
+ memsize = PTRSIZE * 2; | |
+ memalignsize = memsize; | |
+ xalign = global.structalign; | |
+ } | |
+ else | |
+ { | |
+ memsize = v->type->size(); | |
+ memalignsize = v->type->alignsize(); | |
+ xalign = v->type->memalign(global.structalign); | |
+ } | |
AggregateDeclaration::alignmember(xalign, memalignsize, &offset); | |
v->offset = offset; | |
offset += memsize; | |
@@ -488,6 +503,8 @@ | |
tym_t tym = v->type->totym(); | |
if (v->type->toBasetype()->ty == Tsarray || v->isOut() || v->isRef()) | |
tym = TYnptr; // reference parameters are just pointers | |
+ else if (v->storage_class & STClazy) | |
+ tym = TYdelegate; | |
ex = el_bin(OPadd, TYnptr, el_var(sclosure), el_long(TYint, v->offset)); | |
ex = el_una(OPind, tym, ex); | |
if (ex->Ety == TYstruct) | |
diff -r f7d31065be69 d/dmd2/typinf.c | |
--- a/d/dmd2/typinf.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/typinf.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -444,7 +444,7 @@ | |
* char[] name; | |
* void[] init; | |
* hash_t function(in void*) xtoHash; | |
- * int function(in void*, in void*) xopEquals; | |
+ * bool function(in void*, in void*) xopEquals; | |
* int function(in void*, in void*) xopCmp; | |
* string function(const(void)*) xtoString; | |
* uint m_flags; | |
@@ -491,30 +491,29 @@ | |
} | |
TypeFunction *tfeqptr; | |
+ { // bool opEqual(const T*) const; | |
+ Scope sc; | |
+ Arguments *arguments = new Arguments; | |
+ Argument *arg = new Argument(STCin, tc->pointerTo(), NULL, NULL); | |
+ | |
+ arguments->push(arg); | |
+ tfeqptr = new TypeFunction(arguments, Type::tbool, 0, LINKd); | |
+ tfeqptr->mod = MODconst; | |
+ tfeqptr = (TypeFunction *)tfeqptr->semantic(0, &sc); | |
+ } | |
+ | |
+ TypeFunction *tfcmpptr; | |
{ | |
Scope sc; | |
Arguments *arguments = new Arguments; | |
Argument *arg = new Argument(STCin, tc->pointerTo(), NULL, NULL); | |
arguments->push(arg); | |
- tfeqptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); | |
- tfeqptr->mod = MODconst; | |
- tfeqptr = (TypeFunction *)tfeqptr->semantic(0, &sc); | |
+ tfcmpptr = new TypeFunction(arguments, Type::tint32, 0, LINKd); | |
+ tfcmpptr->mod = MODconst; | |
+ tfcmpptr = (TypeFunction *)tfcmpptr->semantic(0, &sc); | |
} | |
-#if 0 | |
- TypeFunction *tfeq; | |
- { | |
- Scope sc; | |
- Array *arguments = new Array; | |
- Argument *arg = new Argument(In, tc, NULL, NULL); | |
- | |
- arguments->push(arg); | |
- tfeq = new TypeFunction(arguments, Type::tint32, 0, LINKd); | |
- tfeq = (TypeFunction *)tfeq->semantic(0, &sc); | |
- } | |
-#endif | |
- | |
s = search_function(sd, Id::tohash); | |
fdx = s ? s->isFuncDeclaration() : NULL; | |
if (fdx) | |
@@ -530,22 +529,35 @@ | |
s = search_function(sd, Id::eq); | |
fdx = s ? s->isFuncDeclaration() : NULL; | |
- for (int i = 0; i < 2; i++) | |
+ if (fdx) | |
{ | |
- if (fdx) | |
- { fd = fdx->overloadExactMatch(tfeqptr); | |
+ //printf("test1 %s, %s, %s\n", fdx->toChars(), fdx->type->toChars(), tfeqptr->toChars()); | |
+ fd = fdx->overloadExactMatch(tfeqptr); | |
+ if (fd) | |
+ dtxoff(pdt, fd->toSymbol(), 0, TYnptr); | |
+ else | |
+ { fd = fdx->overloadExactMatch(tfcmpptr); | |
if (fd) | |
- dtxoff(pdt, fd->toSymbol(), 0, TYnptr); | |
- else | |
- //fdx->error("must be declared as extern (D) int %s(%s*)", fdx->toChars(), sd->toChars()); | |
- dtdword(pdt, 0); | |
+ fdx->error("must return bool, not int"); | |
+ //fdx->error("must be declared as extern (D) int %s(%s*)", fdx->toChars(), sd->toChars()); | |
+ dtdword(pdt, 0); | |
} | |
+ } | |
+ else | |
+ dtdword(pdt, 0); | |
+ | |
+ s = search_function(sd, Id::cmp); | |
+ fdx = s ? s->isFuncDeclaration() : NULL; | |
+ if (fdx) | |
+ { fd = fdx->overloadExactMatch(tfcmpptr); | |
+ if (fd) | |
+ dtxoff(pdt, fd->toSymbol(), 0, TYnptr); | |
else | |
+ //fdx->error("must be declared as extern (D) int %s(%s*)", fdx->toChars(), sd->toChars()); | |
dtdword(pdt, 0); | |
- | |
- s = search_function(sd, Id::cmp); | |
- fdx = s ? s->isFuncDeclaration() : NULL; | |
} | |
+ else | |
+ dtdword(pdt, 0); | |
s = search_function(sd, Id::tostring); | |
fdx = s ? s->isFuncDeclaration() : NULL; | |
diff -r f7d31065be69 d/dmd2/version.c | |
--- a/d/dmd2/version.c Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/version.c Fri Feb 05 10:44:37 2010 +1300 | |
@@ -93,7 +93,7 @@ | |
buf->writenl(); | |
} | |
-char *DebugSymbol::kind() | |
+const char *DebugSymbol::kind() | |
{ | |
return "debug"; | |
} | |
@@ -173,7 +173,7 @@ | |
buf->writenl(); | |
} | |
-char *VersionSymbol::kind() | |
+const char *VersionSymbol::kind() | |
{ | |
return "version"; | |
} | |
diff -r f7d31065be69 d/dmd2/version.h | |
--- a/d/dmd2/version.h Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/dmd2/version.h Fri Feb 05 10:44:37 2010 +1300 | |
@@ -31,7 +31,7 @@ | |
int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
struct VersionSymbol : Dsymbol | |
@@ -45,7 +45,7 @@ | |
int addMember(Scope *sc, ScopeDsymbol *s, int memnum); | |
void semantic(Scope *sc); | |
void toCBuffer(OutBuffer *buf, HdrGenState *hgs); | |
- char *kind(); | |
+ const char *kind(); | |
}; | |
#endif /* DMD_VERSION_H */ | |
diff -r f7d31065be69 d/setup-gcc.sh | |
--- a/d/setup-gcc.sh Sat Jan 16 16:24:03 2010 -0500 | |
+++ b/d/setup-gcc.sh Fri Feb 05 10:44:37 2010 +1300 | |
@@ -1,5 +1,5 @@ | |
#!/bin/sh | |
-# -1. Make sure we are in the top-level GCC soure directory | |
+# -1. Make sure we are in the top-level GCC source directory | |
if test -d gcc && test -d gcc/d && test -f gcc/d/setup-gcc.sh; then | |
: | |
else | |
@@ -8,7 +8,7 @@ | |
fi | |
top=`pwd` | |
-# D 2.0 is the defalt | |
+# D 2.0 is the default | |
if test -d gcc/d/dmd2; then | |
d_lang_version=2 | |
else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment