# HG changeset patch # User trass3r # Date 1284557551 -7200 # Node ID 14feb7ae01a6b289aa532368ffecd1a941174430 # Parent fe2e1b93e88f2ee921b6bb9bdb381655eebea1f8 * changed the build system to build a release version if the debug one compiles and enabled warnings + reduced warnings by adding appriopriate overrides + IfStatement.interpret() + ScopeStatement.interpret() + TypeSArray.constConv() + TypedefDeclaration.syntaxCopy() * fixed a bug in StringExp diff -r fe2e1b93e88f -r 14feb7ae01a6 build.bat --- a/build.bat Wed Sep 15 03:58:55 2010 +0200 +++ b/build.bat Wed Sep 15 15:32:31 2010 +0200 @@ -1,2 +1,2 @@ @echo off -cls && dmc.exe bridge\bridge.cpp -c && dmd.exe @commands.txt \ No newline at end of file +cls && dmc.exe bridge\bridge.cpp -c && dmd -debug -g @commands.txt && dmd -release -O -inline @commands.txt \ No newline at end of file diff -r fe2e1b93e88f -r 14feb7ae01a6 build.sh --- a/build.sh Wed Sep 15 03:58:55 2010 +0200 +++ b/build.sh Wed Sep 15 15:32:31 2010 +0200 @@ -1,4 +1,4 @@ #!/bin/sh #i686-unknown-linux-gnu-g++ -c bridge/bridge.cpp -obridge.o g++ -c bridge/bridge.cpp -obridge.o -dmd @commands.linux.txt #|& head +dmd -debug -gc @commands.linux.txt && dmd -release -O -inline @commands.linux.txt #|& head diff -r fe2e1b93e88f -r 14feb7ae01a6 commands.linux.txt --- a/commands.linux.txt Wed Sep 15 03:58:55 2010 +0200 +++ b/commands.linux.txt Wed Sep 15 15:32:31 2010 +0200 @@ -1,5 +1,4 @@ --gc --debug +-w -version=Bug3602 -version=Bug4054 -version=Bug4059 diff -r fe2e1b93e88f -r 14feb7ae01a6 commands.txt --- a/commands.txt Wed Sep 15 03:58:55 2010 +0200 +++ b/commands.txt Wed Sep 15 15:32:31 2010 +0200 @@ -1,5 +1,4 @@ --g --debug +-w -version=DMDV2 -version=TX86 -version=MARS diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/BinExp.d --- a/dmd/BinExp.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/BinExp.d Wed Sep 15 15:32:31 2010 +0200 @@ -690,7 +690,7 @@ assert(false); } - void scanForNestedRef(Scope sc) + override void scanForNestedRef(Scope sc) { e1.scanForNestedRef(sc); e2.scanForNestedRef(sc); diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/IfStatement.d --- a/dmd/IfStatement.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/IfStatement.d Wed Sep 15 15:32:31 2010 +0200 @@ -9,6 +9,7 @@ import dmd.Scope; import dmd.InterState; import dmd.OutBuffer; +import dmd.GlobalExpressions; import dmd.HdrGenState; import dmd.InlineCostState; import dmd.InlineDoState; @@ -122,7 +123,36 @@ override Expression interpret(InterState istate) { - assert(false); +version(LOG) + writef("IfStatement::interpret(%s)\n", condition.toChars()); + + if (istate.start is this) + istate.start = null; + if (istate.start) + { + Expression e = null; + if (ifbody) + e = ifbody.interpret(istate); + if (istate.start && elsebody) + e = elsebody.interpret(istate); + return e; + } + + Expression e = condition.interpret(istate); + assert(e); + //if (e is EXP_CANT_INTERPRET) writef("cannot interpret\n"); + if (e !is EXP_CANT_INTERPRET) + { + if (e.isBool(true)) + e = ifbody ? ifbody.interpret(istate) : null; + else if (e.isBool(false)) + e = elsebody ? elsebody.interpret(istate) : null; + else + { + e = EXP_CANT_INTERPRET; + } + } + return e; } override void toCBuffer(OutBuffer buf, HdrGenState* hgs) diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/NewAnonClassExp.d --- a/dmd/NewAnonClassExp.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/NewAnonClassExp.d Wed Sep 15 15:32:31 2010 +0200 @@ -64,7 +64,7 @@ return true; } - void toCBuffer(OutBuffer buf, HdrGenState* hgs) + override void toCBuffer(OutBuffer buf, HdrGenState* hgs) { if (thisexp) { diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/PowAssignExp.d --- a/dmd/PowAssignExp.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/PowAssignExp.d Wed Sep 15 15:32:31 2010 +0200 @@ -70,7 +70,7 @@ } // For operator overloading - Identifier opId() + override Identifier opId() { return Id.powass; } diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/ScopeStatement.d --- a/dmd/ScopeStatement.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/ScopeStatement.d Wed Sep 15 15:32:31 2010 +0200 @@ -125,7 +125,12 @@ override Expression interpret(InterState istate) { - assert(false); +version(LOG) + writef("ScopeStatement::interpret()\n"); + + if (istate.start is this) + istate.start = null; + return statement ? statement.interpret(istate) : null; } override Statement inlineScan(InlineScanState* iss) diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/StringExp.d --- a/dmd/StringExp.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/StringExp.d Wed Sep 15 15:32:31 2010 +0200 @@ -315,6 +315,7 @@ case TY.Twchar: case TY.Tdchar: return mm; + default: } break; default: diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/StructDeclaration.d --- a/dmd/StructDeclaration.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/StructDeclaration.d Wed Sep 15 15:32:31 2010 +0200 @@ -432,7 +432,7 @@ } } - Dsymbol search(Loc loc, Identifier ident, int flags) + override Dsymbol search(Loc loc, Identifier ident, int flags) { //printf("%s.StructDeclaration::search('%s')\n", toChars(), ident->toChars()); diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypeDelegate.d --- a/dmd/TypeDelegate.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypeDelegate.d Wed Sep 15 15:32:31 2010 +0200 @@ -79,7 +79,7 @@ return PTRSIZE * 2; } - MATCH implicitConvTo(Type to) + override MATCH implicitConvTo(Type to) { //writef("TypeDelegate::implicitConvTo(this=%p, to=%p)\n", this, to); //writef("from: %s\n", toChars()); diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypeNewArray.d --- a/dmd/TypeNewArray.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypeNewArray.d Wed Sep 15 15:32:31 2010 +0200 @@ -18,7 +18,7 @@ //writef("TypeNewArray\n"); } - void toCBuffer2(OutBuffer buf, HdrGenState *hgs, MOD mod) + override void toCBuffer2(OutBuffer buf, HdrGenState *hgs, MOD mod) { if (mod != this.mod) { diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypeNext.d --- a/dmd/TypeNext.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypeNext.d Wed Sep 15 15:32:31 2010 +0200 @@ -209,7 +209,7 @@ return t; } - Type makeSharedWild() + override Type makeSharedWild() { //printf("TypeNext::makeSharedWild() %s\n", toChars()); if (swto) @@ -232,7 +232,7 @@ return t; } - Type makeMutable() + override Type makeMutable() { //printf("TypeNext::makeMutable() %p, %s\n", this, toChars()); auto t = cast(TypeNext)Type.makeMutable(); diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypeSArray.d --- a/dmd/TypeSArray.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypeSArray.d Wed Sep 15 15:32:31 2010 +0200 @@ -355,7 +355,13 @@ override MATCH constConv(Type to) { - assert(false); + if (to.ty == Tsarray) + { + TypeSArray tsa = cast(TypeSArray)to; + if (!dim.equals(tsa.dim)) + return MATCHnomatch; + } + return super.constConv(to); } override MATCH implicitConvTo(Type to) diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypeStruct.d --- a/dmd/TypeStruct.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypeStruct.d Wed Sep 15 15:32:31 2010 +0200 @@ -392,7 +392,7 @@ * Use when we prefer the default initializer to be a literal, * rather than a global immutable variable. */ - Expression defaultInitLiteral(Loc loc) + override Expression defaultInitLiteral(Loc loc) { version (LOGDEFAULTINIT) { printf("TypeStruct::defaultInitLiteral() '%s'\n", toChars()); diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/TypedefDeclaration.d --- a/dmd/TypedefDeclaration.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/TypedefDeclaration.d Wed Sep 15 15:32:31 2010 +0200 @@ -58,9 +58,42 @@ assert(false); } } - override Dsymbol syntaxCopy(Dsymbol) + override Dsymbol syntaxCopy(Dsymbol s) { - assert(false); + Type basetype = this.basetype.syntaxCopy(); + + Initializer init = null; + if (this.init) + init = this.init.syntaxCopy(); + + assert(!s); + TypedefDeclaration st; + st = new TypedefDeclaration(loc, ident, basetype, init); +version(_DH) +{ + // Syntax copy for header file + if (!htype) // Don't overwrite original + { + if (type) // Make copy for both old and new instances + { + htype = type.syntaxCopy(); + st.htype = type.syntaxCopy(); + } + } + else // Make copy of original for new instance + st.htype = htype.syntaxCopy(); + if (!hbasetype) + { + if (basetype) + { + hbasetype = basetype.syntaxCopy(); + st.hbasetype = basetype.syntaxCopy(); + } + } + else + st.hbasetype = hbasetype.syntaxCopy(); +} + return st; } override void semantic(Scope sc) diff -r fe2e1b93e88f -r 14feb7ae01a6 dmd/UnaExp.d --- a/dmd/UnaExp.d Wed Sep 15 03:58:55 2010 +0200 +++ b/dmd/UnaExp.d Wed Sep 15 15:32:31 2010 +0200 @@ -86,7 +86,7 @@ return e1.canThrow(); } - Expression resolveLoc(Loc loc, Scope sc) + override Expression resolveLoc(Loc loc, Scope sc) { e1 = e1.resolveLoc(loc, sc); return this;