From b7d80963ee7d540f5dff043764208d868a5f3231 Mon Sep 17 00:00:00 2001 From: kai Date: Wed, 6 Nov 2013 02:27:08 +0100 Subject: [PATCH] Mark more differences between DMD and LDC. --- dmd2/func.c | 30 +++++++++++++++++++++++++++++- dmd2/struct.c | 1 - 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dmd2/func.c b/dmd2/func.c index bd96ea88..0aa99506 100644 --- a/dmd2/func.c +++ b/dmd2/func.c @@ -47,8 +47,10 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageCla frequire = NULL; fdrequire = NULL; fdensure = NULL; +#if IN_LLVM fdrequireParams = NULL; fdensureParams = NULL; +#endif outId = NULL; vresult = NULL; returnLabel = NULL; @@ -909,7 +911,11 @@ void FuncDeclaration::semantic(Scope *sc) Parameter *a = NULL; if (outId) { a = new Parameter(STCref | STCconst, f->nextOf(), outId, NULL); +#if IN_LLVM arguments->insert(0, a); +#else + arguments->push(a); +#endif } TypeFunction *tf = new TypeFunction(arguments, Type::tvoid, 0, LINKd); tf->isnothrow = f->isnothrow; @@ -955,9 +961,13 @@ Ldone: } Module::dprogress++; +#if IN_LLVM //LDC relies on semanticRun variable not being reset here if(semanticRun < PASSsemanticdone) semanticRun = PASSsemanticdone; +#else + semanticRun = PASSsemanticdone; +#endif /* Save scope for possible later use (if we need the * function internals) @@ -2329,7 +2339,11 @@ Statement *FuncDeclaration::mergeFrequire(Statement *sf, Expressions *params) sc->pop(); } +#if IN_LLVM sf = fdv->mergeFrequire(sf, params); +#else + sf = fdv->mergeFrequire(sf); +#endif if (sf && fdv->fdrequire) { //printf("fdv->frequire: %s\n", fdv->frequire->toChars()); @@ -2337,7 +2351,12 @@ Statement *FuncDeclaration::mergeFrequire(Statement *sf, Expressions *params) * try { __require(); } * catch { frequire; } */ +#if IN_LLVM Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdrequire, 0), params); +#else + Expression *eresult = NULL; + Expression *e = new CallExp(loc, new VarExp(loc, fdv->fdrequire, 0), eresult); +#endif Statement *s2 = new ExpStatement(loc, e); Catch *c = new Catch(loc, NULL, NULL, sf); @@ -2363,8 +2382,10 @@ Statement *FuncDeclaration::mergeFensure(Statement *sf, Identifier *oid, Express Statement *FuncDeclaration::mergeFensure(Statement *sf, Identifier *oid) #endif { +#if IN_LLVM if (!params) params = fdensureParams; +#endif /* Same comments as for mergeFrequire(), except that we take care * of generating a consistent reference to the 'result' local by @@ -2391,7 +2412,11 @@ Statement *FuncDeclaration::mergeFensure(Statement *sf, Identifier *oid) sc->pop(); } +#if IN_LLVM sf = fdv->mergeFensure(sf, oid, params); +#else + sf = fdv->mergeFensure(sf, oid); +#endif if (fdv->fdensure) { //printf("fdv->fensure: %s\n", fdv->fensure->toChars()); @@ -4285,7 +4310,9 @@ void DtorDeclaration::semantic(Scope *sc) if (!ad) { error("destructors are only for class/struct/union definitions, not %s %s", parent->kind(), parent->toChars()); - fatal(); +#if IN_LLVM + fatal(); +#endif } else if (ident == Id::dtor && semanticRun < PASSsemantic) ad->dtors.push(this); @@ -4721,6 +4748,7 @@ void UnitTestDeclaration::semantic(Scope *sc) { sc = scope; scope = NULL; } + if (global.params.useUnitTests) { if (!type) diff --git a/dmd2/struct.c b/dmd2/struct.c index 09c27907..53886707 100644 --- a/dmd2/struct.c +++ b/dmd2/struct.c @@ -103,7 +103,6 @@ AggregateDeclaration::AggregateDeclaration(Loc loc, Identifier *id) protection = PROTpublic; type = NULL; handle = NULL; - scope = 0; structsize = 0; // size of struct alignsize = 0; // size of struct for alignment purposes hasUnions = 0;