diff -uNr dmd-0.157/dmd/src/dmd/attrib.c dmd-0.158/dmd/src/dmd/attrib.c --- dmd-0.157/dmd/src/dmd/attrib.c 2006-04-25 19:43:00.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/attrib.c 2006-05-24 20:05:14.000000000 +0200 @@ -539,6 +539,7 @@ { this->loc = loc; this->isunion = isunion; + this->scope = NULL; } Dsymbol *AnonDeclaration::syntaxCopy(Dsymbol *s) @@ -553,6 +554,14 @@ void AnonDeclaration::semantic(Scope *sc) { //printf("\tAnonDeclaration::semantic '%s'\n",toChars()); + + Scope *scx = NULL; + if (scope) + { sc = scope; + scx = scope; + scope = NULL; + } + assert(sc->parent); Dsymbol *parent = sc->parent->pastMixin(); @@ -590,9 +599,24 @@ s->semantic(sc); if (isunion) sc->offset = 0; + if (aad.sizeok == 2) + { + break; + } } *sc = sc_save; + // If failed due to forward references, unwind and try again later + if (aad.sizeok == 2) + { + ad->sizeok = 2; + scope = scx ? scx : new Scope(*sc); + scope->setNoFree(); + scope->module->addDeferredSemantic(this); + return; + } + Module::dprogress++; + // 0 sized structs are set to 1 byte if (aad.structsize == 0) { @@ -700,6 +724,7 @@ } fprintf(stdmsg, "\n"); } + goto Lnodecl; } else if (ident == Id::lib) { @@ -714,6 +739,7 @@ if (e->op != TOKstring) error("string expected for library name, not '%s'", e->toChars()); } + goto Lnodecl; } #if IN_GCC else if (ident == Id::GNU_asm) @@ -748,6 +774,7 @@ if (d && s) d->c_ident = Lexer::idPool((char*) s->string); } + goto Lnodecl; } #endif else @@ -762,6 +789,11 @@ s->semantic(sc); } } + return; + +Lnodecl: + if (decl) + error("pragma is missing closing ';'"); } int PragmaDeclaration::oneMember(Dsymbol **ps) @@ -791,6 +823,7 @@ name[se->len] = 0; obj_includelib(name); } + AttribDeclaration::toObjFile(); } void PragmaDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) diff -uNr dmd-0.157/dmd/src/dmd/attrib.h dmd-0.158/dmd/src/dmd/attrib.h --- dmd-0.157/dmd/src/dmd/attrib.h 2006-04-24 21:10:50.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/attrib.h 2006-05-13 00:02:06.000000000 +0200 @@ -97,6 +97,7 @@ struct AnonDeclaration : AttribDeclaration { int isunion; + Scope *scope; // !=NULL means context to use AnonDeclaration(Loc loc, int isunion, Array *decl); Dsymbol *syntaxCopy(Dsymbol *s); diff -uNr dmd-0.157/dmd/src/dmd/class.c dmd-0.158/dmd/src/dmd/class.c --- dmd-0.157/dmd/src/dmd/class.c 2006-04-25 01:21:48.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/class.c 2006-05-12 10:53:44.000000000 +0200 @@ -265,7 +265,7 @@ goto L7; } } - if (!tc->sym->symtab || tc->sym->scope) + if (!tc->sym->symtab || tc->sym->scope || tc->sym->sizeok == 0) { //error("forward reference of base class %s", baseClass->toChars()); // Forward reference of base class, try again later @@ -284,6 +284,7 @@ } } + // Treat the remaining entries in baseclasses as interfaces // Check for errors, handle forward references for (i = (baseClass ? 1 : 0); i < baseclasses.dim; ) { TypeClass *tc; @@ -471,6 +472,8 @@ scope = scx ? scx : new Scope(*sc); scope->setNoFree(); scope->module->addDeferredSemantic(this); + + //printf("\tsemantic('%s') failed\n", toChars()); return; } @@ -545,6 +548,8 @@ } structsize = sc->offset; sizeok = 1; + Module::dprogress++; + sc->pop(); diff -uNr dmd-0.157/dmd/src/dmd/declaration.c dmd-0.158/dmd/src/dmd/declaration.c --- dmd-0.157/dmd/src/dmd/declaration.c 2006-04-17 23:17:32.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/declaration.c 2006-05-24 13:37:52.000000000 +0200 @@ -340,6 +340,7 @@ ScopeDsymbol::multiplyDefined(f, overnext); overnext = NULL; s = fa; + s->parent = sc->parent; } } if (overnext) diff -uNr dmd-0.157/dmd/src/dmd/doc.c dmd-0.158/dmd/src/dmd/doc.c --- dmd-0.157/dmd/src/dmd/doc.c 2006-04-24 21:12:30.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/doc.c 2006-05-22 16:33:26.000000000 +0200 @@ -102,7 +102,7 @@ \n\

$(TITLE)

\n\ $(BODY)\n\ -
$(SMALL Page generated by $(LINK2 http://www.digitalmars.com/d/ddoc.html, Ddoc).)\n\ +
$(SMALL Page generated by $(LINK2 http://www.digitalmars.com/d/ddoc.html, Ddoc). $(COPYRIGHT))\n\ \n\ \n\ B = $0\n\ @@ -141,6 +141,7 @@ \n\ DDOC_DECL = $(DT $(BIG $0))\n\ DDOC_DECL_DD = $(DD $0)\n\ +DDOC_DITTO = $(BR)$0\n\ DDOC_SECTIONS = $0\n\ DDOC_SUMMARY = $0$(BR)$(BR)\n\ DDOC_DESCRIPTION = $0$(BR)$(BR)\n\ @@ -348,10 +349,11 @@ unsigned o; OutBuffer b; - b.writestring("$(BR)"); + b.writestring("$(DDOC_DITTO "); o = b.offset; toDocBuffer(&b); highlightCode(sc, this, &b, o); + b.writeByte(')'); buf->spread(sc->lastoffset, b.offset); memcpy(buf->data + sc->lastoffset, b.data, b.offset); sc->lastoffset += b.offset; @@ -421,7 +423,7 @@ //printf("type = %p\n", type); if (protection == PROTprivate || !ident || - (!type && !isCtorDeclaration())) + (!type && !isCtorDeclaration() && !isAliasDeclaration())) return; if (!comment) return; @@ -600,13 +602,15 @@ void Declaration::toDocBuffer(OutBuffer *buf) { - //printf("Declaration::toDocbuffer()\n"); + //printf("Declaration::toDocbuffer() %s\n", toChars()); if (ident) { if (isDeprecated()) buf->writestring("deprecated "); emitProtection(buf, protection); + if (isAbstract()) + buf->writestring("abstract "); if (isStatic()) buf->writestring("static "); if (isConst()) @@ -629,6 +633,7 @@ void AliasDeclaration::toDocBuffer(OutBuffer *buf) { + //printf("AliasDeclaration::toDocbuffer() %s\n", toChars()); if (ident) { if (isDeprecated()) @@ -915,7 +920,7 @@ } else { - buf->writestring("$(BR)$(BR)\n"); + buf->writestring("$(DDOC_BLANKLINE)\n"); } } diff -uNr dmd-0.157/dmd/src/dmd/expression.c dmd-0.158/dmd/src/dmd/expression.c --- dmd-0.157/dmd/src/dmd/expression.c 2006-04-28 10:52:40.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/expression.c 2006-05-24 02:12:14.000000000 +0200 @@ -1131,7 +1131,16 @@ buf->writestring((char *)(v ? "true" : "false")); break; + case Tpointer: + buf->writestring("cast("); + buf->writestring(t->toChars()); + buf->writeByte(')'); + goto L3; + default: +#ifdef DEBUG + t->print(); +#endif assert(0); } } @@ -2371,8 +2380,16 @@ if (cdn) { - if (!sc->func || sc->func->isThis() != cdn) - error("no 'this' for nested class %s", cd->toChars()); + for (Dsymbol *sf = sc->func; 1; sf= sf->toParent()->isFuncDeclaration()) + { + if (!sf) + { + error("outer class %s 'this' needed to 'new' nested class %s", cdn->toChars(), cd->toChars()); + break; + } + if (sf->isThis() == cdn) + break; + } } } f = cd->ctor; @@ -3626,6 +3643,10 @@ e1 = e1->semantic(sc); var = var->toAlias()->isDeclaration(); type = var->type; + if (!type && global.errors) + { // var is goofed up, just return 0 + return new IntegerExp(0); + } assert(type); if (!var->isFuncDeclaration()) // for functions, do checks after overload resolution diff -uNr dmd-0.157/dmd/src/dmd/expression.h dmd-0.158/dmd/src/dmd/expression.h --- dmd-0.157/dmd/src/dmd/expression.h 2006-04-15 00:00:22.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/expression.h 2006-05-23 01:33:20.000000000 +0200 @@ -56,6 +56,7 @@ FuncDeclaration *search_function(AggregateDeclaration *ad, Identifier *funcid); void inferApplyArgTypes(Array *arguments, Type *taggr); void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); +void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); struct Expression : Object { diff -uNr dmd-0.157/dmd/src/dmd/func.c dmd-0.158/dmd/src/dmd/func.c --- dmd-0.157/dmd/src/dmd/func.c 2006-04-26 21:56:06.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/func.c 2006-05-14 14:54:36.000000000 +0200 @@ -314,11 +314,6 @@ cd->vtbl.push(this); vtblIndex = vi; - if (isOverride()) - { - error("function %s does not override any", toChars()); - } - L1: ; /* Go through all the interface bases. @@ -369,11 +364,18 @@ } tintro = ti; } + goto L2; } } } } + if (introducing && isOverride()) + { + error("function %s does not override any", toChars()); + } + + L2: ; } else if (isOverride() && !parent->isTemplateInstance()) error("override only applies to class member functions"); @@ -1617,6 +1619,7 @@ { this->arguments = arguments; this->varargs = varargs; + //printf("CtorDeclaration() %s\n", toChars()); } Dsymbol *CtorDeclaration::syntaxCopy(Dsymbol *s) diff -uNr dmd-0.157/dmd/src/dmd/link.c dmd-0.158/dmd/src/dmd/link.c --- dmd-0.157/dmd/src/dmd/link.c 2006-04-12 00:21:00.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/link.c 2006-05-24 02:14:12.000000000 +0200 @@ -187,6 +187,8 @@ if (global.params.symdebug) argv.push((void *)"-g"); + argv.push((void *)"-m32"); + argv.push((void *)"-lphobos"); // turns into /usr/lib/libphobos.a argv.push((void *)"-lpthread"); argv.push((void *)"-lm"); diff -uNr dmd-0.157/dmd/src/dmd/mars.c dmd-0.158/dmd/src/dmd/mars.c --- dmd-0.157/dmd/src/dmd/mars.c 2006-05-10 11:34:14.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/mars.c 2006-05-12 10:55:34.000000000 +0200 @@ -58,7 +58,7 @@ copyright = "Copyright (c) 1999-2006 by Digital Mars"; written = "written by Walter Bright"; - version = "v0.157"; + version = "v0.158"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); @@ -147,6 +147,7 @@ -debug=level compile in debug code <= level\n\ -debug=ident compile in debug code identified by ident\n\ -g add symbolic debug info\n\ + -gc add symbolic debug info, pretend to be C\n\ -H generate 'header' file\n\ -Hdhdrdir write 'header' file to hdrdir directory\n\ -Hffilename write 'header' file to filename\n\ diff -uNr dmd-0.157/dmd/src/dmd/module.c dmd-0.158/dmd/src/dmd/module.c --- dmd-0.157/dmd/src/dmd/module.c 2006-04-25 01:21:04.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/module.c 2006-05-11 01:48:30.000000000 +0200 @@ -44,6 +44,7 @@ Array Module::amodules; Array Module::deferred; // deferred Dsymbol's needing semantic() run on them +unsigned Module::dprogress; void Module::init() { @@ -801,6 +802,7 @@ deferred.push(s); } + /****************************************** * Run semantic() on deferred symbols. */ @@ -812,11 +814,12 @@ static int nested; if (nested) return; - //if (deferred.dim) printf("Module::runDeferredSemantic('%s'), len = %d\n", toChars(), deferred.dim); + //if (deferred.dim) printf("+Module::runDeferredSemantic('%s'), len = %d\n", toChars(), deferred.dim); nested++; do { + dprogress = 0; len = deferred.dim; if (!len) break; @@ -841,8 +844,9 @@ s->semantic(NULL); } - } while (deferred.dim < len); // while making progress + } while (deferred.dim < len || dprogress); // while making progress nested--; + //printf("-Module::runDeferredSemantic('%s'), len = %d\n", toChars(), deferred.dim); } /* =========================== ModuleDeclaration ===================== */ diff -uNr dmd-0.157/dmd/src/dmd/module.h dmd-0.158/dmd/src/dmd/module.h --- dmd-0.157/dmd/src/dmd/module.h 2006-03-24 18:28:34.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/module.h 2006-05-11 01:47:12.000000000 +0200 @@ -47,6 +47,7 @@ static DsymbolTable *modules; // symbol table of all modules static Array amodules; // array of all modules static Array deferred; // deferred Dsymbol's needing semantic() run on them + static unsigned dprogress; // progress resolving the deferred list static void init(); static ClassDeclaration *moduleinfo; diff -uNr dmd-0.157/dmd/src/dmd/parse.c dmd-0.158/dmd/src/dmd/parse.c --- dmd-0.157/dmd/src/dmd/parse.c 2006-03-22 11:29:36.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/parse.c 2006-05-23 01:47:20.000000000 +0200 @@ -1,5 +1,5 @@ -// Copyright (c) 1999-2005 by Digital Mars +// Copyright (c) 1999-2006 by Digital Mars // All Rights Reserved // written by Walter Bright // www.digitalmars.com @@ -54,9 +54,6 @@ // Support left-to-right array declarations #define LTORARRAYDECL 1 -// Suppor references -#define REFERENCES 0 - /************************************ * These control how parseStatement() works. */ @@ -998,8 +995,12 @@ if (token.value == TOKrcurly) ; else + { addComment(em, comment); + comment = NULL; check(TOKcomma); + } addComment(em, comment); + comment = token.blockComment; } else { error("enum member expected"); @@ -1625,7 +1626,7 @@ } Type *Parser::parseBasicType2(Type *t) -{ Expression *e; +{ Type *ts; Type *ta; @@ -1639,12 +1640,6 @@ nextToken(); continue; -#if REFERENCES - case TOKand: - t = new TypeReference(t); - nextToken(); - continue; -#endif case TOKlbracket: #if LTORARRAYDECL // Handle []. Make sure things like @@ -1669,7 +1664,7 @@ else { //printf("it's [expression]\n"); - e = parseExpression(); // [ expression ] + Expression *e = parseExpression(); // [ expression ] t = new TypeSArray(t,e); check(TOKrbracket); } @@ -1700,7 +1695,7 @@ else { //printf("it's [expression]\n"); - e = parseExpression(); // [ expression ] + Expression *e = parseExpression(); // [ expression ] ta = new TypeSArray(t,e); check(TOKrbracket); } @@ -1741,134 +1736,34 @@ return ts; } -Type *Parser::parseDeclarator(Type *t, Identifier **pident) -{ Expression *e; - Type *ts; +Type *Parser::parseDeclarator(Type *t, Identifier **pident, TemplateParameters **tpl) +{ Type *ts; Type *ta; - Type **pt; - - //printf("parseDeclarator(t = %p)\n", t); - while (1) - { - switch (token.value) - { - case TOKmul: - t = new TypePointer(t); - nextToken(); - continue; - -#if REFERENCES - case TOKand: - t = new TypeReference(t); - nextToken(); - continue; -#endif - - case TOKlbracket: -#if LTORARRAYDECL - // Handle []. Make sure things like - // int[3][1] a; - // is (array[1] of array[3] of int) - nextToken(); - if (token.value == TOKrbracket) - { - t = new TypeDArray(t); // [] - nextToken(); - } - else if (isDeclaration(&token, 0, TOKrbracket, NULL)) - { // It's an associative array declaration - Type *index; - //printf("it's an associative array\n"); - index = parseBasicType(); - index = parseDeclarator(index, NULL); // [ type ] - t = new TypeAArray(t, index); - check(TOKrbracket); - } - else - { - //printf("it's [expression]\n"); - e = parseExpression(); // [ expression ] - t = new TypeSArray(t,e); - check(TOKrbracket); - } - continue; -#else - // Handle []. Make sure things like - // int[3][1] a; - // is (array[3] of array[1] of int) - ts = t; - while (token.value == TOKlbracket) - { - nextToken(); - if (token.value == TOKrbracket) - { - ta = new TypeDArray(t); // [] - nextToken(); - } - else if (isDeclaration(&token, 0, TOKrbracket, NULL)) - { // It's an associative array declaration - Type *index; - - //printf("it's an associative array\n"); - index = parseBasicType(); - index = parseDeclarator(index, NULL); // [ type ] - check(TOKrbracket); - ta = new TypeAArray(t, index); - } - else - { - //printf("it's [expression]\n"); - e = parseExpression(); // [ expression ] - ta = new TypeSArray(t,e); - check(TOKrbracket); - } - for (pt = &ts; *pt != t; pt = &(*pt)->next) - ; - *pt = ta; - } - t = ts; - continue; -#endif + //printf("parseDeclarator(tpl = %p)\n", tpl); + t = parseBasicType2(t); - case TOKidentifier: - if (pident) - *pident = token.ident; - else - error("unexpected identifer '%s' in declarator", token.ident->toChars()); - ts = t; - nextToken(); - break; + switch (token.value) + { - case TOKlparen: - nextToken(); - ts = parseDeclarator(t, pident); - check(TOKrparen); - break; + case TOKidentifier: + if (pident) + *pident = token.ident; + else + error("unexpected identifer '%s' in declarator", token.ident->toChars()); + ts = t; + nextToken(); + break; - case TOKdelegate: - case TOKfunction: - { // Handle delegate declaration: - // t delegate(parameter list) - // t function(parameter list) - Array *arguments; - int varargs; - enum TOK save = token.value; + case TOKlparen: + nextToken(); + ts = parseDeclarator(t, pident); + check(TOKrparen); + break; - nextToken(); - arguments = parseParameters(&varargs); - t = new TypeFunction(arguments, t, varargs, linkage); - if (save == TOKdelegate) - t = new TypeDelegate(t); - else - t = new TypePointer(t); // pointer to function - continue; - } - default: - ts = t; - break; - } - break; + default: + ts = t; + break; } while (1) @@ -1877,8 +1772,7 @@ { #if CARRAYDECL case TOKlbracket: - // This is the old C-style post [] syntax. - // Should we disallow it? + { // This is the old C-style post [] syntax. nextToken(); if (token.value == TOKrbracket) { @@ -1898,25 +1792,67 @@ else { //printf("it's [expression]\n"); - e = parseExpression(); // [ expression ] - ta = new TypeSArray(t,e); + Expression *e = parseExpression(); // [ expression ] + ta = new TypeSArray(t, e); check(TOKrbracket); } + Type **pt; for (pt = &ts; *pt != t; pt = &(*pt)->next) ; *pt = ta; continue; + } #endif case TOKlparen: { Array *arguments; int varargs; + Type **pt; + + if (tpl) + { + /* Look ahead to see if this is (...)(...), + * i.e. a function template declaration + */ + Token *tk = &token; + int parens = 1; + while (1) + { + tk = peek(tk); + switch (tk->value) + { + case TOKlparen: + parens++; + continue; + + case TOKrparen: + --parens; + if (parens) + continue; + break; + + case TOKeof: + break; + + default: + continue; + } + if (peek(tk)->value == TOKlparen) + { // It's a function template declaration + //printf("function template declaration\n"); + + // Gather template parameter list + *tpl = parseTemplateParameterList(); + } + break; + } + } arguments = parseParameters(&varargs); ta = new TypeFunction(arguments, t, varargs, linkage); for (pt = &ts; *pt != t; pt = &(*pt)->next) ; *pt = ta; - continue; + break; } } break; @@ -2034,9 +1970,10 @@ while (1) { Loc loc = this->loc; + TemplateParameters *tpl = NULL; ident = NULL; - t = parseDeclarator(ts,&ident); + t = parseDeclarator(ts, &ident, &tpl); assert(t); if (!tfirst) tfirst = t; @@ -2083,6 +2020,7 @@ } else if (t->ty == Tfunction) { FuncDeclaration *f; + Dsymbol *s; f = new FuncDeclaration(loc, 0, ident, storage_class, t); addComment(f, comment); @@ -2090,15 +2028,25 @@ addComment(f, NULL); if (link == linkage) { - a->push(f); + s = f; } else { Array *ax = new Array(); ax->push(f); - Dsymbol *s = new LinkDeclaration(link, ax); - a->push(s); + s = new LinkDeclaration(link, ax); + } + if (tpl) // it's a function template + { Array *decldefs; + TemplateDeclaration *tempdecl; + + // Wrap a template around the aggregate declaration + decldefs = new Array(); + decldefs->push(s); + tempdecl = new TemplateDeclaration(loc, s->ident, tpl, decldefs); + s = tempdecl; } + a->push(s); } else { VarDeclaration *v; @@ -2833,7 +2781,12 @@ args = parseArguments(); // pragma(identifier, args...); else check(TOKrparen); // pragma(identifier); - body = parseStatement(PSsemi); + if (token.value == TOKsemicolon) + { nextToken(); + body = NULL; + } + else + body = parseStatement(PSsemi); s = new PragmaStatement(loc, ident, args, body); break; } diff -uNr dmd-0.157/dmd/src/dmd/parse.h dmd-0.158/dmd/src/dmd/parse.h --- dmd-0.157/dmd/src/dmd/parse.h 2006-03-12 12:19:38.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/parse.h 2006-05-21 00:12:32.000000000 +0200 @@ -79,7 +79,7 @@ Import *parseImport(Array *decldefs); Type *parseBasicType(); Type *parseBasicType2(Type *t); - Type *parseDeclarator(Type *t, Identifier **pident); + Type *parseDeclarator(Type *t, Identifier **pident, TemplateParameters **tpl = NULL); Array *parseDeclarations(); void parseContracts(FuncDeclaration *f); Statement *parseStatement(int flags); diff -uNr dmd-0.157/dmd/src/dmd/statement.c dmd-0.158/dmd/src/dmd/statement.c --- dmd-0.157/dmd/src/dmd/statement.c 2006-04-15 00:00:46.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/statement.c 2006-05-24 13:48:28.000000000 +0200 @@ -1432,6 +1432,8 @@ Statement *PragmaStatement::semantic(Scope *sc) { // Should be merged with PragmaDeclaration + //printf("PragmaStatement::semantic() %s\n", toChars()); + //printf("body = %p\n", body); if (ident == Id::msg) { if (args) @@ -1490,8 +1492,30 @@ void PragmaStatement::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { - buf->printf("PragmaStatement::toCBuffer()"); - buf->writenl(); + buf->writestring("pragma ("); + buf->writestring(ident->toChars()); + if (args && args->dim) + { + buf->writestring(", "); + argsToCBuffer(buf, args, hgs); + } + buf->writeByte(')'); + if (body) + { + buf->writenl(); + buf->writeByte('{'); + buf->writenl(); + + body->toCBuffer(buf, hgs); + + buf->writeByte('}'); + buf->writenl(); + } + else + { + buf->writeByte(';'); + buf->writenl(); + } } diff -uNr dmd-0.157/dmd/src/dmd/staticassert.c dmd-0.158/dmd/src/dmd/staticassert.c --- dmd-0.157/dmd/src/dmd/staticassert.c 2006-04-09 15:27:54.000000000 +0200 +++ dmd-0.158/dmd/src/dmd/staticassert.c 2006-05-14 15:12:00.000000000 +0200 @@ -49,11 +49,13 @@ e = exp->semantic(sc); e = e->optimize(WANTvalue); if (e->isBool(FALSE)) - error("(%s) is false", exp->toChars()); + { error("(%s) is false", exp->toChars()); + if (!global.gag) + fatal(); + } else if (!e->isBool(TRUE)) { error("(%s) is not evaluatable at compile time", exp->toChars()); -printf("%s\n", e->toChars()); } } diff -uNr dmd-0.157/dmd/src/dmd/struct.c dmd-0.158/dmd/src/dmd/struct.c --- dmd-0.157/dmd/src/dmd/struct.c 2006-03-07 18:59:06.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/struct.c 2006-05-13 00:07:24.000000000 +0200 @@ -157,7 +157,7 @@ unsigned memalignsize; // size of member for alignment purposes unsigned xalign; // alignment boundaries - //printf("AggregateDeclaration::addField('%s')\n", v->toChars()); + //printf("AggregateDeclaration::addField('%s') %s\n", v->toChars(), toChars()); // Check for forward referenced types which will fail the size() call Type *t = v->type->toBasetype(); @@ -361,6 +361,7 @@ structsize = (structsize + alignsize - 1) & ~(alignsize - 1); sizeok = 1; + Module::dprogress++; //printf("-StructDeclaration::semantic(this=%p, '%s')\n", this, toChars()); diff -uNr dmd-0.157/dmd/src/dmd/template.c dmd-0.158/dmd/src/dmd/template.c --- dmd-0.157/dmd/src/dmd/template.c 2006-03-07 19:02:16.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/template.c 2006-05-24 13:38:20.000000000 +0200 @@ -548,8 +548,9 @@ { TemplateParameter *tp = (TemplateParameter *)parameters->data[i]; Object *oarg = (Object *)dedargs->data[i]; + Object *o = (Object *)dedtypes.data[i]; if (!oarg) - { Object *o = (Object *)dedtypes.data[i]; + { if (o) { if (tp->specialization()) @@ -607,7 +608,12 @@ s = v; } else + { +#ifdef DEBUG + o->print(); +#endif assert(0); + } if (!sc->insert(s)) error("declaration %s is already defined", tp->ident->toChars()); s->semantic(sc); @@ -834,6 +840,8 @@ if (tp->ident->equals(id)) { // Found the corresponding parameter + if (!tp->isTemplateTypeParameter()) + goto Lnomatch; Type *at = (Type *)dedtypes->data[i]; if (!at) { @@ -1750,7 +1758,16 @@ void TemplateInstance::semantic(Scope *sc) { if (global.errors) + { + if (!global.gag) + { + /* Trying to soldier on rarely generates useful messages + * at this point. + */ + fatal(); + } return; + } #if LOG printf("+TemplateInstance::semantic('%s', this=%p)\n", toChars(), this); #endif @@ -2061,7 +2078,7 @@ TemplateDeclaration *TemplateInstance::findTemplateDeclaration(Scope *sc) { - //printf("TemplateInstance::findTemplateDeclaration()\n"); + //printf("TemplateInstance::findTemplateDeclaration() %s\n", toChars()); if (!tempdecl) { /* Given: diff -uNr dmd-0.157/dmd/src/dmd/toobj.c dmd-0.158/dmd/src/dmd/toobj.c --- dmd-0.157/dmd/src/dmd/toobj.c 2006-03-12 12:59:40.000000000 +0100 +++ dmd-0.158/dmd/src/dmd/toobj.c 2006-05-14 16:19:44.000000000 +0200 @@ -751,6 +751,7 @@ // See if we can convert a comdat to a comdef, // which saves on exe file space. if (sinit->Sclass == SCcomdat && + sinit->Sdt && sinit->Sdt->dt == DT_azeros && sinit->Sdt->DTnext == NULL) { @@ -876,6 +877,7 @@ // See if we can convert a comdat to a comdef, // which saves on exe file space. if (s->Sclass == SCcomdat && + s->Sdt && s->Sdt->dt == DT_azeros && s->Sdt->DTnext == NULL) { @@ -889,9 +891,11 @@ else s->Sseg = DATA; #endif /* ELFOBJ */ - outdata(s); - if (isExport()) - obj_export(s,0); + if (sz) + { outdata(s); + if (isExport()) + obj_export(s,0); + } } } diff -uNr dmd-0.157/dmd/src/phobos/std/c/linux/linux.d dmd-0.158/dmd/src/phobos/std/c/linux/linux.d --- dmd-0.157/dmd/src/phobos/std/c/linux/linux.d 2006-05-10 12:13:22.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/c/linux/linux.d 2006-05-25 01:12:56.000000000 +0200 @@ -2,6 +2,8 @@ /* Written by Walter Bright, Christopher E. Miller, and many others. * www.digitalmars.com * Placed into public domain. + * Linux(R) is the registered trademark of Linus Torvalds in the U.S. and other + * countries. */ module std.c.linux.linux; diff -uNr dmd-0.157/dmd/src/phobos/std/c/linux/linuxextern.d dmd-0.158/dmd/src/phobos/std/c/linux/linuxextern.d --- dmd-0.157/dmd/src/phobos/std/c/linux/linuxextern.d 2006-05-10 12:13:22.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/c/linux/linuxextern.d 2006-05-25 01:12:56.000000000 +0200 @@ -1,7 +1,10 @@ -// Copyright (C) 2003 by Digital Mars, www.digitalmars.com -// All Rights Reserved -// Written by Walter Bright +/* Written by Walter Bright. + * www.digitalmars.com + * Placed into public domain. + * Linux(R) is the registered trademark of Linus Torvalds in the U.S. and other + * countries. + */ /* These are all the globals defined by the linux C runtime library. * Put them separate so they'll be externed - do not link in linuxextern.o diff -uNr dmd-0.157/dmd/src/phobos/std/c/windows/windows.d dmd-0.158/dmd/src/phobos/std/c/windows/windows.d --- dmd-0.157/dmd/src/phobos/std/c/windows/windows.d 2006-05-10 12:13:22.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/c/windows/windows.d 2006-05-25 01:12:56.000000000 +0200 @@ -1,4 +1,7 @@ +/* Windows is a registered trademark of Microsoft Corporation in the United +States and other countries. */ + module std.c.windows.windows; version (Windows) diff -uNr dmd-0.157/dmd/src/phobos/std/regexp.d dmd-0.158/dmd/src/phobos/std/regexp.d --- dmd-0.157/dmd/src/phobos/std/regexp.d 2006-05-10 12:13:20.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/regexp.d 2006-05-25 01:12:54.000000000 +0200 @@ -24,7 +24,7 @@ */ /********************************************** - * $(LINK2 ../../../ctg/regular.html, Regular expressions) + * $(LINK2 http://www.digitalmars.com/ctg/regular.html, Regular expressions) * are a powerful method of string pattern matching. * The regular expression * language used is the same as that commonly used, however, some of the very diff -uNr dmd-0.157/dmd/src/phobos/std/string.d dmd-0.158/dmd/src/phobos/std/string.d --- dmd-0.157/dmd/src/phobos/std/string.d 2006-05-10 12:13:20.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/string.d 2006-05-25 01:12:54.000000000 +0200 @@ -3690,6 +3690,30 @@ * in one of a known set of strings, and the program will helpfully * autocomplete the string once sufficient characters have been * entered that uniquely identify it. + * Example: + * --- + * import std.stdio; + * import std.string; + * + * void main() + * { + * static char[][] list = [ "food", "foxy" ]; + * + * auto abbrevs = std.string.abbrev(list); + * + * foreach (key, value; abbrevs) + * { + * writefln("%s => %s", key, value); + * } + * } + * --- + * produces the output: + *
+ * fox => foxy
+ * food => food
+ * foxy => foxy
+ * foo => food
+ * 
*/ char[][char[]] abbrev(char[][] values) @@ -3804,6 +3828,20 @@ /****************************************** * Wrap text into a paragraph. + * + * The input text string s is formed into a paragraph + * by breaking it up into a sequence of lines, delineated + * by \n, such that the number of columns is not exceeded + * on each line. + * The last line is terminated with a \n. + * Params: + * s = text string to be wrapped + * columns = maximum number of _columns in the paragraph + * firstindent = string used to _indent first line of the paragraph + * indent = string to use to _indent following lines of the paragraph + * tabsize = column spacing of tabs + * Returns: + * The resulting paragraph. */ char[] wrap(char[] s, int columns = 80, char[] firstindent = null, @@ -3863,7 +3901,7 @@ result ~= '\n'; result ~= indent; } - else + else if (result.length != firstindent.length) result ~= ' '; result ~= s[wordstart .. s.length]; } @@ -3883,6 +3921,8 @@ assert(wrap(" a bc df ", 3) == "a\nbc\ndf\n"); //writefln("'%s'", wrap(" abcd df ",3)); assert(wrap(" abcd df ", 3) == "abcd\ndf\n"); + assert(wrap("x") == "x\n"); + assert(wrap("u u") == "u u\n"); } diff -uNr dmd-0.157/dmd/src/phobos/std/uni.d dmd-0.158/dmd/src/phobos/std/uni.d --- dmd-0.157/dmd/src/phobos/std/uni.d 2006-05-10 12:13:20.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std/uni.d 2006-05-25 01:12:54.000000000 +0200 @@ -13,6 +13,8 @@ * $(LINK2 http://www.digitalmars.com/d/ascii-table.html, ASCII Table), * $(LINK2 http://en.wikipedia.org/wiki/Unicode, Wikipedia), * $(LINK2 http://www.unicode.org, The Unicode Consortium) + * Trademarks: + * Unicode(tm) is a trademark of Unicode, Inc. */ diff -uNr dmd-0.157/dmd/src/phobos/std.ddoc dmd-0.158/dmd/src/phobos/std.ddoc --- dmd-0.157/dmd/src/phobos/std.ddoc 2006-05-10 12:13:20.000000000 +0200 +++ dmd-0.158/dmd/src/phobos/std.ddoc 2006-05-25 01:12:54.000000000 +0200 @@ -17,7 +17,7 @@
- www.digitalmars.com + www.digitalmars.com Home | Search