Mercurial > projects > ldc
diff dmd/attrib.c @ 1602:a413ae7329bf
Merge DMD r243: some harmonization with D2 dmd
---
dmd/aggregate.h | 24 ++++-
dmd/attrib.c | 63 ++++++----
dmd/attrib.h | 10 +-
dmd/declaration.h | 5 +-
dmd/func.c | 337 ++++++++++++++++++++++-------------------------------
dmd/mars.c | 2 +-
dmd/mars.h | 7 +
dmd/mtype.h | 13 ++-
dmd/parse.c | 32 ++++-
dmd/parse.h | 14 ++-
dmd/scope.h | 2 +-
11 files changed, 263 insertions(+), 246 deletions(-)
author | Leandro Lucarella <llucax@gmail.com> |
---|---|
date | Wed, 06 Jan 2010 15:18:19 -0300 |
parents | def7a1d494fd |
children | 44b145be2ef5 |
line wrap: on
line diff
--- a/dmd/attrib.c Mon Dec 28 02:23:54 2009 +0000 +++ b/dmd/attrib.c Wed Jan 06 15:18:19 2010 -0300 @@ -78,7 +78,7 @@ } void AttribDeclaration::setScopeNewSc(Scope *sc, - unsigned stc, enum LINK linkage, enum PROT protection, int explicitProtection, + StorageClass stc, enum LINK linkage, enum PROT protection, int explicitProtection, unsigned structalign) { if (decl) @@ -113,7 +113,7 @@ } void AttribDeclaration::semanticNewSc(Scope *sc, - unsigned stc, enum LINK linkage, enum PROT protection, int explicitProtection, + StorageClass stc, enum LINK linkage, enum PROT protection, int explicitProtection, unsigned structalign) { if (decl) @@ -360,7 +360,7 @@ /************************* StorageClassDeclaration ****************************/ -StorageClassDeclaration::StorageClassDeclaration(unsigned stc, Array *decl) +StorageClassDeclaration::StorageClassDeclaration(StorageClass stc, Array *decl) : AttribDeclaration(decl) { this->stc = stc; @@ -379,7 +379,7 @@ { if (decl) { - unsigned scstc = sc->stc; + StorageClass scstc = sc->stc; /* These sets of storage classes are mutually exclusive, * so choose the innermost or most recent one. @@ -402,7 +402,7 @@ { if (decl) { - unsigned scstc = sc->stc; + StorageClass scstc = sc->stc; /* These sets of storage classes are mutually exclusive, * so choose the innermost or most recent one. @@ -421,11 +421,11 @@ } } -void StorageClassDeclaration::stcToCBuffer(OutBuffer *buf, int stc) +void StorageClassDeclaration::stcToCBuffer(OutBuffer *buf, StorageClass stc) { struct SCstring { - int stc; + StorageClass stc; enum TOK tok; }; @@ -441,6 +441,19 @@ { STCsynchronized, TOKsynchronized }, { STCdeprecated, TOKdeprecated }, { STCoverride, TOKoverride }, + { STClazy, TOKlazy }, + { STCalias, TOKalias }, + { STCout, TOKout }, + { STCin, TOKin }, +#if DMDV2 + { STCimmutable, TOKimmutable }, + { STCshared, TOKshared }, + { STCnothrow, TOKnothrow }, + { STCpure, TOKpure }, + { STCref, TOKref }, + { STCtls, TOKtls }, + { STCgshared, TOKgshared }, +#endif }; for (int i = 0; i < sizeof(table)/sizeof(table[0]); i++) @@ -1006,25 +1019,27 @@ goto Lnodecl; } #endif +#if DMDV2 + else if (ident == Id::startaddress) + { + if (!args || args->dim != 1) + error("function name expected for start address"); + else + { + Expression *e = (Expression *)args->data[0]; + e = e->semantic(sc); + e = e->optimize(WANTvalue | WANTinterpret); + args->data[0] = (void *)e; + Dsymbol *sa = getDsymbol(e); + if (!sa || !sa->isFuncDeclaration()) + error("function name expected for start address, not '%s'", e->toChars()); + } + goto Lnodecl; + } +#endif #if TARGET_NET else if (ident == Lexer::idPool("assembly")) { - if (!args || args->dim != 1) - error("pragma has invalid number of arguments"); - else - { - Expression *e = (Expression *)args->data[0]; - e = e->semantic(sc); - e = e->optimize(WANTvalue | WANTinterpret); - args->data[0] = (void *)e; - if (e->op != TOKstring) - { - error("string expected, not '%s'", e->toChars()); - } - PragmaScope* pragma = new PragmaScope(this, sc->parent, static_cast<StringExp*>(e)); - decl = new Array; - decl->push(pragma); - } } #endif // TARGET_NET @@ -1385,7 +1400,7 @@ e->toCBuffer(buf, hgs); } } - buf->writestring(")"); + buf->writeByte(')'); AttribDeclaration::toCBuffer(buf, hgs); }