diff --git a/dmd/declaration.c b/dmd/declaration.c index 7287c80140..8ba40def15 100644 --- a/dmd/declaration.c +++ b/dmd/declaration.c @@ -1099,6 +1099,7 @@ int VarDeclaration::hasPointers() Expression *VarDeclaration::callAutoDtor() { Expression *e = NULL; + //printf("VarDeclaration::callAutoDtor() %s\n", toChars()); if (storage_class & (STCauto | STCscope) && !noauto) { for (ClassDeclaration *cd = type->isClassHandle(); @@ -1109,6 +1110,8 @@ Expression *VarDeclaration::callAutoDtor() * classes to determine if there's no way the monitor * could be set. */ + if (cd->isInterfaceDeclaration()) + error("interface %s cannot be scope", cd->toChars()); if (1 || onstack || cd->dtors.dim) // if any destructors { // delete this; diff --git a/dmd/expression.c b/dmd/expression.c index 17002ffb08..49268cfe8d 100644 --- a/dmd/expression.c +++ b/dmd/expression.c @@ -518,7 +518,7 @@ void functionArguments(Loc loc, Scope *sc, TypeFunction *tf, Expressions *argume { // BUG: should check that argument to ref is type 'invariant' // BUG: assignments to ref should also be type 'invariant' - arg = arg->modifiableLvalue(sc, NULL); + arg = arg->modifiableLvalue(sc, arg); //if (arg->op == TOKslice) //arg->error("cannot modify slice %s", arg->toChars()); @@ -4357,7 +4357,7 @@ Expression *BinExp::commonSemanticAssign(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); type = e1->type; if (type->toBasetype()->ty == Tbool) @@ -4388,7 +4388,7 @@ Expression *BinExp::commonSemanticAssignIntegral(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); type = e1->type; if (type->toBasetype()->ty == Tbool) @@ -6874,7 +6874,7 @@ Expression *PostExp::semantic(Scope *sc) return e; e = this; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); if (e1->type->ty == Tpointer) @@ -7060,7 +7060,7 @@ Expression *AssignExp::semantic(Scope *sc) // e1 is not an lvalue, but we let code generator handle it ArrayLengthExp *ale = (ArrayLengthExp *)e1; - ale->e1 = ale->e1->modifiableLvalue(sc, NULL); + ale->e1 = ale->e1->modifiableLvalue(sc, e1); } else if (e1->op == TOKslice) ; @@ -7122,7 +7122,7 @@ Expression *AddAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); Type *tb1 = e1->type->toBasetype(); Type *tb2 = e2->type->toBasetype(); @@ -7222,7 +7222,7 @@ Expression *MinAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); if (e1->type->ty == Tpointer && e2->type->isintegral()) @@ -7267,7 +7267,7 @@ Expression *CatAssignExp::semantic(Scope *sc) error("cannot append to static array %s", se->e1->type->toChars()); } - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); Type *tb1 = e1->type->toBasetype(); Type *tb2 = e2->type->toBasetype(); @@ -7316,7 +7316,7 @@ Expression *MulAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); type = e1->type; @@ -7372,7 +7372,7 @@ Expression *DivAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); type = e1->type; @@ -7443,7 +7443,7 @@ Expression *ShlAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); type = e1->type; @@ -7472,7 +7472,7 @@ Expression *ShrAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); type = e1->type; @@ -7501,7 +7501,7 @@ Expression *UshrAssignExp::semantic(Scope *sc) if (e) return e; - e1 = e1->modifiableLvalue(sc, NULL); + e1 = e1->modifiableLvalue(sc, e1); e1->checkScalar(); e1->checkNoBool(); type = e1->type; diff --git a/dmd/lexer.c b/dmd/lexer.c index db66c12729..4b21486006 100644 --- a/dmd/lexer.c +++ b/dmd/lexer.c @@ -2162,7 +2162,7 @@ done: break; if (d >= r) break; - if (n * r + d < n) + if (n && n * r + d <= n) { error ("integer overflow"); break; diff --git a/dmd/mangle.c b/dmd/mangle.c index ee25c2e375..1e88fcee7e 100644 --- a/dmd/mangle.c +++ b/dmd/mangle.c @@ -141,8 +141,10 @@ char *FuncDeclaration::mangle() if (isMain()) return "_Dmain"; + if (isWinMain() || isDllMain()) + return ident->toChars(); + assert(this); - return Declaration::mangle(); } diff --git a/dmd/mars.c b/dmd/mars.c index 6f4ee3db77..22bc46cb45 100644 --- a/dmd/mars.c +++ b/dmd/mars.c @@ -1,5 +1,5 @@ // Compiler implementation of the D programming language -// 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 @@ -68,10 +68,10 @@ Global::Global() #error "fix this" #endif - copyright = "Copyright (c) 1999-2007 by Digital Mars and Tomas Lindquist Olsen"; + copyright = "Copyright (c) 1999-2008 by Digital Mars and Tomas Lindquist Olsen"; written = "written by Walter Bright and Tomas Lindquist Olsen"; llvmdc_version = "0.1"; - version = "v1.025"; + version = "v1.026"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); @@ -823,7 +823,6 @@ int main(int argc, char *argv[]) continue; } -#if !IN_LLVM #if TARGET_LINUX if (strcmp(ext, "a") == 0) #else @@ -833,7 +832,6 @@ int main(int argc, char *argv[]) global.params.libfiles->push(files.data[i]); continue; } -#endif if (strcmp(ext, global.ddoc_ext) == 0) { diff --git a/dmd/module.c b/dmd/module.c index d691aaa39e..3a22fe4ea4 100644 --- a/dmd/module.c +++ b/dmd/module.c @@ -162,7 +162,7 @@ Module::Module(char *filename, Identifier *ident, int doDocComment, int doHdrGen symfile = new File(symfilename); // LLVMDC - llvmCompileUnit = 0; + irModule = NULL; } void Module::setDocfile() diff --git a/dmd/module.h b/dmd/module.h index 7b68da64b1..620febf31b 100644 --- a/dmd/module.h +++ b/dmd/module.h @@ -29,7 +29,7 @@ struct VarDeclaration; #if IN_LLVM struct DValue; typedef DValue elem; -namespace llvm { class GlobalVariable; } +struct IrModule; #else #ifdef IN_GCC union tree_node; typedef union tree_node elem; @@ -169,7 +169,7 @@ struct Module : Package void genmoduleinfo(); // LLVMDC - llvm::GlobalVariable* llvmCompileUnit; + IrModule* irModule; Module *isModule() { return this; } }; diff --git a/dmd/mtype.c b/dmd/mtype.c index d585457783..69b125ba6b 100644 --- a/dmd/mtype.c +++ b/dmd/mtype.c @@ -3973,6 +3973,15 @@ Expression *TypeTypedef::dotExp(Scope *sc, Expression *e, Identifier *ident) return sym->basetype->dotExp(sc, e, ident); } +Expression *TypeTypedef::getProperty(Loc loc, Identifier *ident) +{ + if (ident == Id::init) + { + return Type::getProperty(loc, ident); + } + return sym->basetype->getProperty(loc, ident); +} + int TypeTypedef::isbit() { return sym->basetype->isbit(); @@ -4276,6 +4285,18 @@ L1: return e; } + TemplateInstance *ti = s->isTemplateInstance(); + if (ti) + { if (!ti->semanticdone) + ti->semantic(sc); + s = ti->inst->toAlias(); + if (!s->isTemplateInstance()) + goto L1; + Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti)); + de->type = e->type; + return de; + } + d = s->isDeclaration(); #ifdef DEBUG if (!d) @@ -4646,6 +4667,18 @@ L1: return e; } + TemplateInstance *ti = s->isTemplateInstance(); + if (ti) + { if (!ti->semanticdone) + ti->semantic(sc); + s = ti->inst->toAlias(); + if (!s->isTemplateInstance()) + goto L1; + Expression *de = new DotExp(e->loc, e, new ScopeExp(e->loc, ti)); + de->type = e->type; + return de; + } + d = s->isDeclaration(); if (!d) { diff --git a/dmd/mtype.h b/dmd/mtype.h index 43b397f771..7ba9aaf2ea 100644 --- a/dmd/mtype.h +++ b/dmd/mtype.h @@ -587,6 +587,7 @@ struct TypeTypedef : Type void toTypeInfoBuffer(OutBuffer *buf); void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); + Expression *getProperty(Loc loc, Identifier *ident); int isbit(); int isintegral(); int isfloating(); diff --git a/dmd/parse.c b/dmd/parse.c index e4705e07f7..77e2053bf6 100644 --- a/dmd/parse.c +++ b/dmd/parse.c @@ -1219,13 +1219,12 @@ Lerr: TemplateParameters *Parser::parseTemplateParameterList() { - TemplateParameters *tpl; + TemplateParameters *tpl = new TemplateParameters(); if (token.value != TOKlparen) { error("parenthesized TemplateParameterList expected following TemplateIdentifier"); goto Lerr; } - tpl = new TemplateParameters(); nextToken(); // Get array of TemplateParameters @@ -1309,7 +1308,7 @@ TemplateParameters *Parser::parseTemplateParameterList() if (!tp_ident) { error("no identifier for template value parameter"); - goto Lerr; + tp_ident = new Identifier("error", TOKidentifier); } if (token.value == TOKcolon) // : CondExpression { @@ -1330,10 +1329,8 @@ TemplateParameters *Parser::parseTemplateParameterList() } } check(TOKrparen); - return tpl; - Lerr: - return NULL; + return tpl; } /****************************************** diff --git a/dmd/statement.c b/dmd/statement.c index 8a23097d40..5a83ef6c97 100644 --- a/dmd/statement.c +++ b/dmd/statement.c @@ -1982,6 +1982,7 @@ Statement *SwitchStatement::semantic(Scope *sc) { condition = condition->integralPromotions(sc); condition->checkIntegral(); } + condition = condition->optimize(WANTvalue); sc = sc->push(); sc->sbreak = this; diff --git a/dmd/template.c b/dmd/template.c index 589ab88fa7..17d17124e1 100644 --- a/dmd/template.c +++ b/dmd/template.c @@ -1,6 +1,6 @@ // Compiler implementation of the D programming language -// 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 @@ -1540,6 +1540,9 @@ MATCH TypeInstance::deduceType(Scope *sc, else if (tempinst->tempdecl != tp->tempinst->tempdecl) goto Lnomatch; + if (tempinst->tiargs->dim != tp->tempinst->tiargs->dim) + goto Lnomatch; + for (int i = 0; i < tempinst->tiargs->dim; i++) { //printf("test: [%d]\n", i); @@ -3008,6 +3011,8 @@ void TemplateInstance::semanticTiargs(Loc loc, Scope *sc, Objects *tiargs) ea = ea->semantic(sc); ea = ea->optimize(WANTvalue | WANTinterpret); tiargs->data[j] = ea; + if (ea->op == TOKtype) + tiargs->data[j] = ea->type; } else if (sa) { @@ -3292,6 +3297,9 @@ int TemplateInstance::isNested(Objects *args) Lsa: Declaration *d = sa->isDeclaration(); if (d && !d->isDataseg() && +#if V2 + !(d->storage_class & STCmanifest) && +#endif (!d->isFuncDeclaration() || d->isFuncDeclaration()->isNested()) && !isTemplateMixin()) { diff --git a/gen/functions.cpp b/gen/functions.cpp index 09039ce7f7..7645141d78 100644 --- a/gen/functions.cpp +++ b/gen/functions.cpp @@ -459,10 +459,7 @@ void DtoDefineFunc(FuncDeclaration* fd) // debug info if (global.params.symdebug) { Module* mo = fd->getModule(); - if (!mo->llvmCompileUnit) { - mo->llvmCompileUnit = DtoDwarfCompileUnit(mo,false); - } - fd->irFunc->dwarfSubProg = DtoDwarfSubProgram(fd, mo->llvmCompileUnit); + fd->irFunc->dwarfSubProg = DtoDwarfSubProgram(fd, DtoDwarfCompileUnit(mo)); } Type* t = DtoDType(fd->type); diff --git a/gen/todebug.cpp b/gen/todebug.cpp index d3c198273c..a8181b9cfd 100644 --- a/gen/todebug.cpp +++ b/gen/todebug.cpp @@ -11,6 +11,8 @@ #include "gen/tollvm.h" #include "gen/logger.h" +#include "ir/irmodule.h" + using namespace llvm::dwarf; static const llvm::PointerType* ptrTy(const llvm::Type* t) @@ -110,27 +112,40 @@ const llvm::StructType* GetDwarfSubProgramType() { ////////////////////////////////////////////////////////////////////////////////////////////////// -llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m, bool define) +llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m) { - llvm::Constant* c = NULL; - if (1 || define) { - std::vector vals; - vals.push_back(llvm::ConstantExpr::getAdd( - DtoConstUint(DW_TAG_compile_unit), - DtoConstUint(llvm::LLVMDebugVersion))); - vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_compile_unit))); - - vals.push_back(DtoConstUint(DW_LANG_C));// _D)); // doesn't seem to work - vals.push_back(DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata")); - std::string srcpath(FileName::path(m->srcfile->name->toChars())); - //srcpath.append("/"); - vals.push_back(DtoConstStringPtr(srcpath.c_str(), "llvm.metadata")); - vals.push_back(DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata")); - - c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals); + if (!m->irModule) + m->irModule = new IrModule(m); + else if (m->irModule->dwarfCompileUnit) + { + if (m->irModule->dwarfCompileUnit->getParent() == gIR->module) + return m->irModule->dwarfCompileUnit; } + + // create a valid compile unit constant for the current module + + llvm::Constant* c = NULL; + + std::vector vals; + vals.push_back(llvm::ConstantExpr::getAdd( + DtoConstUint(DW_TAG_compile_unit), + DtoConstUint(llvm::LLVMDebugVersion))); + vals.push_back(dbgToArrTy(GetDwarfAnchor(DW_TAG_compile_unit))); + + vals.push_back(DtoConstUint(DW_LANG_C));// _D)); // doesn't seem to work + vals.push_back(DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata")); + std::string srcpath(FileName::path(m->srcfile->name->toChars())); + if (srcpath.empty()) + srcpath = "."; + vals.push_back(DtoConstStringPtr(srcpath.c_str(), "llvm.metadata")); + vals.push_back(DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata")); + + c = llvm::ConstantStruct::get(GetDwarfCompileUnitType(), vals); + llvm::GlobalVariable* gv = new llvm::GlobalVariable(GetDwarfCompileUnitType(), true, llvm::GlobalValue::InternalLinkage, c, "llvm.dbg.compile_unit", gIR->module); gv->setSection("llvm.metadata"); + + m->irModule->dwarfCompileUnit = gv; return gv; } @@ -181,7 +196,7 @@ void DtoDwarfStopPoint(unsigned ln) std::vector args; args.push_back(DtoConstUint(ln)); args.push_back(DtoConstUint(0)); - assert(gIR->dmodule->llvmCompileUnit); - args.push_back(dbgToArrTy(gIR->dmodule->llvmCompileUnit)); + FuncDeclaration* fd = gIR->func()->decl; + args.push_back(dbgToArrTy(DtoDwarfCompileUnit(fd->getModule()))); gIR->ir->CreateCall(gIR->module->getFunction("llvm.dbg.stoppoint"), args.begin(), args.end()); } diff --git a/gen/todebug.h b/gen/todebug.h index 8a2d4c60ac..8dc25834bb 100644 --- a/gen/todebug.h +++ b/gen/todebug.h @@ -7,7 +7,7 @@ const llvm::StructType* GetDwarfAnchorType(); const llvm::StructType* GetDwarfCompileUnitType(); const llvm::StructType* GetDwarfSubProgramType(); -llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m, bool define); +llvm::GlobalVariable* DtoDwarfCompileUnit(Module* m); llvm::GlobalVariable* DtoDwarfSubProgram(FuncDeclaration* fd, llvm::GlobalVariable* compileUnit); void DtoDwarfFuncStart(FuncDeclaration* fd); diff --git a/gen/toobj.cpp b/gen/toobj.cpp index 1040298e21..80cb0c2fd6 100644 --- a/gen/toobj.cpp +++ b/gen/toobj.cpp @@ -42,6 +42,7 @@ #include "gen/runtime.h" #include "ir/irvar.h" +#include "ir/irmodule.h" ////////////////////////////////////////////////////////////////////////////////////////// @@ -59,10 +60,15 @@ void Module::genobjfile() deleteObjFile(); // create a new ir state + // TODO look at making the instance static and moving most functionality into IrModule where it belongs IRState ir; gIR = &ir; ir.dmodule = this; + // module ir state + // might already exist via import, just overwrite... + irModule = new IrModule(this); + // name the module std::string mname(toChars()); if (md != 0) @@ -88,7 +94,7 @@ void Module::genobjfile() // debug info if (global.params.symdebug) { RegisterDwarfSymbols(ir.module); - ir.dmodule->llvmCompileUnit = DtoDwarfCompileUnit(this,true); + DtoDwarfCompileUnit(this); } // start out by providing opaque for the built-in class types diff --git a/ir/irmodule.cpp b/ir/irmodule.cpp index d030fadf22..b8114619e8 100644 --- a/ir/irmodule.cpp +++ b/ir/irmodule.cpp @@ -3,6 +3,7 @@ IrModule::IrModule(Module* module) { M = module; + dwarfCompileUnit = NULL; } IrModule::~IrModule() diff --git a/ir/irmodule.h b/ir/irmodule.h index 04185bf0d4..7edfe1619d 100644 --- a/ir/irmodule.h +++ b/ir/irmodule.h @@ -11,6 +11,8 @@ struct IrModule : IrBase virtual ~IrModule(); Module* M; + + llvm::GlobalVariable* dwarfCompileUnit; }; #endif diff --git a/llvmdc.kdevelop.filelist b/llvmdc.kdevelop.filelist index f6e44c2c14..222088b8c5 100644 --- a/llvmdc.kdevelop.filelist +++ b/llvmdc.kdevelop.filelist @@ -250,6 +250,16 @@ lphobos/typeinfos1.d lphobos/typeinfos2.d premake.lua runalltests.d +suite +suite/dwarfdebug +suite/dwarfdebug/dwarf1 +suite/dwarfdebug/dwarf1/app.d +suite/dwarfdebug/dwarf1/build.sh +suite/dwarfdebug/dwarf1/lib.d +suite/dwarfdebug/dwarf2 +suite/dwarfdebug/dwarf2/app.d +suite/dwarfdebug/dwarf2/build.sh +suite/dwarfdebug/dwarf2/lib.d tango tango/lib tango/lib/common @@ -759,6 +769,7 @@ tangotests/q.d tangotests/r.d tangotests/s.d tangotests/t.d +tangotests/u.d test test/a.d test/aa1.d diff --git a/suite/dwarfdebug/dwarf1/app.d b/suite/dwarfdebug/dwarf1/app.d new file mode 100644 index 0000000000..4b013efaa2 --- /dev/null +++ b/suite/dwarfdebug/dwarf1/app.d @@ -0,0 +1,12 @@ +module app; +import lib; + +void func() +{ + lib_func(); +} + +void main() +{ + func(); +} diff --git a/suite/dwarfdebug/dwarf1/build.sh b/suite/dwarfdebug/dwarf1/build.sh new file mode 100755 index 0000000000..07d8303f9e --- /dev/null +++ b/suite/dwarfdebug/dwarf1/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +llvmdc lib.d -c -g -dis +llvmdc app.d lib.bc -g -dis -ofapp diff --git a/suite/dwarfdebug/dwarf1/lib.d b/suite/dwarfdebug/dwarf1/lib.d new file mode 100644 index 0000000000..3f57ac5ece --- /dev/null +++ b/suite/dwarfdebug/dwarf1/lib.d @@ -0,0 +1,7 @@ +module lib; + +void lib_func() +{ + int* p; + *p = 666; +} diff --git a/suite/dwarfdebug/dwarf2/app.d b/suite/dwarfdebug/dwarf2/app.d new file mode 100644 index 0000000000..f63152c28f --- /dev/null +++ b/suite/dwarfdebug/dwarf2/app.d @@ -0,0 +1,14 @@ +module app; +import lib; + +void func() +{ + int* ip; + int i = lib_templ_func(ip); +} + +int main(char[][] args) +{ + func(); + return 0; +} diff --git a/suite/dwarfdebug/dwarf2/build.sh b/suite/dwarfdebug/dwarf2/build.sh new file mode 100755 index 0000000000..07d8303f9e --- /dev/null +++ b/suite/dwarfdebug/dwarf2/build.sh @@ -0,0 +1,3 @@ +#!/bin/bash +llvmdc lib.d -c -g -dis +llvmdc app.d lib.bc -g -dis -ofapp diff --git a/suite/dwarfdebug/dwarf2/lib.d b/suite/dwarfdebug/dwarf2/lib.d new file mode 100644 index 0000000000..d1c7d2c28e --- /dev/null +++ b/suite/dwarfdebug/dwarf2/lib.d @@ -0,0 +1,6 @@ +module lib; + +T lib_templ_func(T)(T* a) +{ + return *a; +} diff --git a/tango/lib/common/tango/llvmdc.mak b/tango/lib/common/tango/llvmdc.mak index 2d0b4463d8..0851c876df 100644 --- a/tango/lib/common/tango/llvmdc.mak +++ b/tango/lib/common/tango/llvmdc.mak @@ -22,14 +22,14 @@ MD=mkdir -p ADD_CFLAGS= ADD_DFLAGS= -CFLAGS=-O $(ADD_CFLAGS) -#CFLAGS=-g $(ADD_CFLAGS) +#CFLAGS=-O $(ADD_CFLAGS) +CFLAGS=-g $(ADD_CFLAGS) -DFLAGS=-release -O -inline -w -nofloat $(ADD_DFLAGS) -#DFLAGS=-g -w -nofloat $(ADD_DFLAGS) +#DFLAGS=-release -O -inline -w $(ADD_DFLAGS) +DFLAGS=-g -w $(ADD_DFLAGS) -TFLAGS=-O -inline -w -nofloat $(ADD_DFLAGS) -#TFLAGS=-g -w -nofloat $(ADD_DFLAGS) +#TFLAGS=-O -inline -w $(ADD_DFLAGS) +TFLAGS=-g -w $(ADD_DFLAGS) DOCFLAGS=-version=DDoc diff --git a/tango/lib/compiler/llvmdc/cast.d b/tango/lib/compiler/llvmdc/cast.d index dcff9817eb..2c9ae6e41a 100644 --- a/tango/lib/compiler/llvmdc/cast.d +++ b/tango/lib/compiler/llvmdc/cast.d @@ -27,7 +27,7 @@ extern (C): -debug = PRINTF; +//debug = PRINTF; debug(PRINTF) int printf(char*, ...); /****************************************** diff --git a/tango/lib/compiler/llvmdc/llvmdc.mak b/tango/lib/compiler/llvmdc/llvmdc.mak index 644e73d773..de2c68f740 100644 --- a/tango/lib/compiler/llvmdc/llvmdc.mak +++ b/tango/lib/compiler/llvmdc/llvmdc.mak @@ -20,14 +20,14 @@ CP=cp -f RM=rm -f MD=mkdir -p -CFLAGS=-O3 $(ADD_CFLAGS) -#CFLAGS=-g $(ADD_CFLAGS) +#CFLAGS=-O3 $(ADD_CFLAGS) +CFLAGS=-g $(ADD_CFLAGS) -DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS) -#DFLAGS=-g -w $(ADD_DFLAGS) +#DFLAGS=-release -O3 -inline -w $(ADD_DFLAGS) +DFLAGS=-g -w $(ADD_DFLAGS) -TFLAGS=-O3 -inline -w $(ADD_DFLAGS) -#TFLAGS=-g -w $(ADD_DFLAGS) +#TFLAGS=-O3 -inline -w $(ADD_DFLAGS) +TFLAGS=-g -w $(ADD_DFLAGS) DOCFLAGS=-version=DDoc diff --git a/tango/lib/gc/stub/llvmdc.mak b/tango/lib/gc/stub/llvmdc.mak index edd438e9d2..36b0d0ff07 100644 --- a/tango/lib/gc/stub/llvmdc.mak +++ b/tango/lib/gc/stub/llvmdc.mak @@ -20,16 +20,16 @@ MD=mkdir -p ADD_CFLAGS= ADD_DFLAGS= -CFLAGS=-O $(ADD_CFLAGS) -#CFLAGS=-g $(ADD_CFLAGS) +#CFLAGS=-O $(ADD_CFLAGS) +CFLAGS=-g $(ADD_CFLAGS) ### warnings disabled because gcx has issues ### -DFLAGS=-release -O -inline $(ADD_DFLAGS) -#DFLAGS=-g $(ADD_DFLAGS) +#DFLAGS=-release -O -inline $(ADD_DFLAGS) +DFLAGS=-g $(ADD_DFLAGS) -TFLAGS=-O -inline $(ADD_DFLAGS) -#TFLAGS=-g $(ADD_DFLAGS) +#TFLAGS=-O -inline $(ADD_DFLAGS) +TFLAGS=-g $(ADD_DFLAGS) DOCFLAGS=-version=DDoc diff --git a/tango/tango/io/Buffer.d b/tango/tango/io/Buffer.d index 9d37b50c0f..0560259125 100644 --- a/tango/tango/io/Buffer.d +++ b/tango/tango/io/Buffer.d @@ -25,7 +25,6 @@ public import tango.io.model.IBuffer, extern (C) { protected void * memcpy (void *dst, void *src, uint); - private int printf(char*, ...); } /******************************************************************************* @@ -164,18 +163,10 @@ class Buffer : IBuffer this (IConduit conduit) { - printf("Buffer.this(%p)\n", conduit); - printf("assert (conduit !is null);\n"); - assert (conduit !is null); - printf("assert (conduit);\n", conduit); assert (conduit); - printf("this (conduit.bufferSize(%p));\n", conduit); - printf("cast(Object)conduit = %p\n", cast(Object)conduit); this (conduit.bufferSize); setConduit (conduit); - - assert(this !is null); } /*********************************************************************** @@ -230,7 +221,6 @@ class Buffer : IBuffer this (uint capacity = 0) { - printf("Buffer.this(%p, %u)\n", this, capacity); setContent (new ubyte[capacity], 0); assert(this !is null); } @@ -551,7 +541,6 @@ class Buffer : IBuffer IBuffer append (void* src, uint length) { - printf("Buffer.append(%p, %u)\n", src, length); if (length > writable) // can we write externally? if (sink) @@ -571,9 +560,7 @@ class Buffer : IBuffer } else error (overflow); - printf(" copying\n"); copy (src, length); - printf("returning\n"); return this; } @@ -1097,7 +1084,6 @@ class Buffer : IBuffer protected void copy (void *src, uint size) { - printf("Buffer.copy(%p, %u)\n", src, size); // avoid "out of bounds" test on zero size if (size) { @@ -1105,7 +1091,6 @@ class Buffer : IBuffer memcpy (&data[extent], src, size); extent += size; } - printf(" copy done\n"); } /*********************************************************************** diff --git a/tango/tango/io/Console.d b/tango/tango/io/Console.d index 092b9aaa51..0cd77580be 100644 --- a/tango/tango/io/Console.d +++ b/tango/tango/io/Console.d @@ -23,7 +23,6 @@ private import tango.io.Buffer, version (Posix) private import tango.stdc.posix.unistd; // needed for isatty() -private extern(C) int printf(char*, ...); /******************************************************************************* @@ -70,7 +69,6 @@ struct Console private this (Conduit conduit, bool redirected) { - printf("Console.Input.this(%p, %d)\n", conduit, redirected); assert (conduit); redirect = redirected; buffer = new Buffer (conduit); @@ -599,7 +597,6 @@ struct Console private this (Handle handle) { - printf("Console.Conduit.this(%d)\n", handle); reopen (handle); redirected = (isatty(handle) is 0); } @@ -627,18 +624,12 @@ static Console.Output Cout, /// the standard output stream static this () { - printf("STATIC INIT FOR CONSOLE\n"); - printf("Cin conduit\n"); auto conduit = new Console.Conduit (0); - assert(conduit); - printf("Cin input\n"); Cin = new Console.Input (conduit, conduit.redirected); - printf("Cout\n"); conduit = new Console.Conduit (1); Cout = new Console.Output (conduit, conduit.redirected); - printf("Cerr\n"); conduit = new Console.Conduit (2); Cerr = new Console.Output (conduit, conduit.redirected); } diff --git a/tango/tango/io/DeviceConduit.d b/tango/tango/io/DeviceConduit.d index 0e4f6f387f..6f66d36f98 100644 --- a/tango/tango/io/DeviceConduit.d +++ b/tango/tango/io/DeviceConduit.d @@ -18,8 +18,6 @@ public import tango.io.Conduit; private import tango.core.Exception; -private extern(C) int printf(char*, ...); - /******************************************************************************* Implements a means of reading and writing a file device. Conduits diff --git a/tangotests/l.d b/tangotests/l.d index 75a3f8af51..5623a866b6 100644 --- a/tangotests/l.d +++ b/tangotests/l.d @@ -2,13 +2,5 @@ import tango.io.Console; void main() { - printf("enter\n"); - assert(Cout !is null); - printf("newline\n"); - Cout.newline; - printf("hi message\n"); Cout("Hi, says LLVMDC + Tango").newline; - printf("exit\n"); } - -extern(C) int printf(char*,...);