Changeset 522

Show
Ignore:
Timestamp:
04/19/07 18:21:35 (1 year ago)
Author:
Gregor
Message:

Thu Apr 19 15:18:40 PDT 2007 Richards@codu.org

  • Adde pre/post digen commands.

Thu Apr 19 14:17:05 PDT 2007 Richards@codu.org

  • rebuild/mars.c: Added flags= variable to configuration files.

Thu Apr 19 14:07:36 PDT 2007 Richards@codu.org

  • MERGE: DMD 1.013

Thu Apr 19 14:07:10 PDT 2007 Richards@codu.org

  • Local branch.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/docs/README.software_engineers

    r521 r522  
    9494    section. 
    9595 
    96 * prebuild, preinstall, preclean, postbuild, postinstall, postclean 
    97   * Commands to be run before/after building/installing/cleaning the current 
    98     section. Can be any number of ;-separated commands, and supports some 
    99     special command types: 
     96* prebuild, preinstall, preclean, predigen, postbuild, postinstall, postclean, 
     97  postdigen 
     98  * Commands to be run before or after (pre or post) building (build), 
     99    installing (install), cleaning (clean) or generating .di files (digen) for 
     100    the current section. Can be any number of ;-separated commands, and 
     101    supports some special command types: 
    100102    * .d files. If a .d file is specified as a command, it will be compiled and 
    101103      run. 
  • trunk/rebuild/README

    r509 r522  
    8080path=<path>             Adds <path> to $PATH (or %PATH%) during each rebuild 
    8181                        run. 
     82flags=<flags>           Acts as though <flags> were passed with every rebuild 
     83                        run. 
  • trunk/rebuild/cast.c

    r459 r522  
    404404} 
    405405 
     406int AssocArrayLiteralExp::implicitConvTo(Type *t) 
     407{   MATCH result = MATCHexact; 
     408 
     409    Type *typeb = type->toBasetype(); 
     410    Type *tb = t->toBasetype(); 
     411    if (tb->ty == Taarray && typeb->ty == Taarray) 
     412    { 
     413    for (size_t i = 0; i < keys->dim; i++) 
     414    {   Expression *e = (Expression *)keys->data[i]; 
     415        MATCH m = (MATCH)e->implicitConvTo(((TypeAArray *)tb)->key); 
     416        if (m < result) 
     417        result = m;         // remember worst match 
     418        if (result == MATCHnomatch) 
     419        break;              // no need to check for worse 
     420        e = (Expression *)values->data[i]; 
     421        m = (MATCH)e->implicitConvTo(tb->next); 
     422        if (m < result) 
     423        result = m;         // remember worst match 
     424        if (result == MATCHnomatch) 
     425        break;              // no need to check for worse 
     426    } 
     427    return result; 
     428    } 
     429    else 
     430    return Expression::implicitConvTo(t); 
     431} 
     432 
    406433int AddrExp::implicitConvTo(Type *t) 
    407434{ 
     
    919946    { 
    920947    type = typeb->next->pointerTo(); 
     948    } 
     949L1: 
     950    return Expression::castTo(sc, t); 
     951} 
     952 
     953Expression *AssocArrayLiteralExp::castTo(Scope *sc, Type *t) 
     954{ 
     955    Type *typeb = type->toBasetype(); 
     956    Type *tb = t->toBasetype(); 
     957    if (tb->ty == Taarray && typeb->ty == Taarray && 
     958    tb->next->toBasetype()->ty != Tvoid) 
     959    { 
     960    assert(keys->dim == values->dim); 
     961    for (size_t i = 0; i < keys->dim; i++) 
     962    {   Expression *e = (Expression *)values->data[i]; 
     963        e = e->castTo(sc, tb->next); 
     964        values->data[i] = (void *)e; 
     965 
     966        e = (Expression *)keys->data[i]; 
     967        e = e->castTo(sc, ((TypeAArray *)tb)->key); 
     968        keys->data[i] = (void *)e; 
     969    } 
     970    type = t; 
     971    return this; 
    921972    } 
    922973L1: 
  • trunk/rebuild/constfold.c

    r459 r522  
    10191019    e = new IntegerExp(loc, dim, type); 
    10201020    } 
     1021    else if (e1->op == TOKassocarrayliteral) 
     1022    {   AssocArrayLiteralExp *ale = (AssocArrayLiteralExp *)e1; 
     1023    size_t dim = ale->keys->dim; 
     1024 
     1025    e = new IntegerExp(loc, dim, type); 
     1026    } 
    10211027    else 
    10221028    e = EXP_CANT_INTERPRET; 
     
    10881094        {   e = (Expression *)ale->elements->data[i]; 
    10891095        e->type = type; 
     1096        } 
     1097    } 
     1098    } 
     1099    else if (e1->op == TOKassocarrayliteral && !e1->checkSideEffect(2)) 
     1100    { 
     1101    AssocArrayLiteralExp *ae = (AssocArrayLiteralExp *)e1; 
     1102    /* Search the keys backwards, in case there are duplicate keys 
     1103     */ 
     1104    for (size_t i = ae->keys->dim; i;) 
     1105    { 
     1106        i--; 
     1107        Expression *ekey = (Expression *)ae->keys->data[i]; 
     1108        Expression *ex = Equal(TOKequal, Type::tbool, ekey, e2); 
     1109        if (ex == EXP_CANT_INTERPRET) 
     1110        return ex; 
     1111        if (ex->isBool(TRUE)) 
     1112        {   e = (Expression *)ae->values->data[i]; 
     1113        e->type = type; 
     1114        break; 
    10901115        } 
    10911116    } 
  • trunk/rebuild/declaration.c

    r461 r522  
    597597{ 
    598598    //printf("VarDeclaration::semantic('%s', parent = '%s')\n", toChars(), sc->parent->toChars()); 
     599    //printf("type = %s\n", type->toChars()); 
     600    //printf("linkage = %d\n", sc->linkage); 
    599601    //if (strcmp(toChars(), "mul") == 0) halt(); 
    600602 
  • trunk/rebuild/expression.c

    r461 r522  
    4343#endif 
    4444 
    45 #include "port.h" 
     45//#include "port.h" 
    4646#include "mtype.h" 
    4747#include "init.h" 
     
    34163416        exps->push(e); 
    34173417    } 
     3418    else if (o->dyncast() == DYNCAST_TYPE) 
     3419    { 
     3420        Type *t = (Type *)o; 
     3421        Expression *e = new TypeExp(loc, t); 
     3422        exps->push(e); 
     3423    } 
    34183424    else 
    34193425    { 
     
    41754181Expression *CompileExp::semantic(Scope *sc) 
    41764182{ 
    4177 #if 1 || LOGSEMANTIC 
     4183#if LOGSEMANTIC 
    41784184    printf("CompileExp::semantic('%s')\n", toChars()); 
    41794185#endif 
     
    41814187    e1 = resolveProperties(sc, e1); 
    41824188    e1 = e1->optimize(WANTvalue | WANTinterpret); 
    4183 e1->print(); 
    41844189    if (e1->op != TOKstring) 
    41854190    {   //error("argument to mixin must be a string, not (%s)", e1->toChars()); 
     
    59245929    } 
    59255930    } 
    5926     return e1->castTo(sc, to); 
     5931    e = e1->castTo(sc, to); 
     5932    return e; 
    59275933} 
    59285934 
  • trunk/rebuild/expression.h

    r461 r522  
    368368    Expression *optimize(int result); 
    369369    Expression *interpret(InterState *istate); 
     370    int implicitConvTo(Type *t); 
     371    Expression *castTo(Scope *sc, Type *t); 
    370372 
    371373    int inlineCost(InlineCostState *ics); 
  • trunk/rebuild/interpret.c

    r461 r522  
    992992 
    993993Expression *AssocArrayLiteralExp::interpret(InterState *istate) 
    994 {   Expressions *keysx = NULL
    995     Expressions *valuesx = NULL
     994{   Expressions *keysx = keys
     995    Expressions *valuesx = values
    996996 
    997997#if LOG 
     
    10051005    ex = ekey->interpret(istate); 
    10061006    if (ex == EXP_CANT_INTERPRET) 
    1007     {   delete keysx; 
    1008         delete valuesx; 
    1009         return EXP_CANT_INTERPRET; 
    1010     } 
     1007        goto Lerr; 
    10111008 
    10121009    /* If any changes, do Copy On Write 
     
    10141011    if (ex != ekey) 
    10151012    { 
    1016         if (!keysx) 
    1017         {   keysx = new Expressions(); 
    1018         keysx->setDim(keys->dim); 
    1019         for (size_t j = 0; j < i; j++) 
    1020         { 
    1021             keysx->data[j] = keys->data[j]; 
    1022         } 
    1023         } 
     1013        if (keysx == keys) 
     1014        keysx = (Expressions *)keys->copy(); 
    10241015        keysx->data[i] = (void *)ex; 
    10251016    } 
     
    10271018    ex = evalue->interpret(istate); 
    10281019    if (ex == EXP_CANT_INTERPRET) 
    1029     {   delete keysx; 
    1030         delete valuesx; 
    1031         return EXP_CANT_INTERPRET; 
    1032     } 
     1020        goto Lerr; 
    10331021 
    10341022    /* If any changes, do Copy On Write 
     
    10361024    if (ex != evalue) 
    10371025    { 
    1038         if (!valuesx) 
    1039         {   valuesx = new Expressions(); 
    1040         valuesx->setDim(values->dim); 
    1041         for (size_t j = 0; j < i; j++) 
    1042         { 
    1043             valuesx->data[j] = values->data[j]; 
    1044         } 
    1045         } 
     1026        if (valuesx == values) 
     1027        valuesx = (Expressions *)values->copy(); 
    10461028        valuesx->data[i] = (void *)ex; 
    10471029    } 
    10481030    } 
    1049     if (keysx || valuesx) 
    1050     { 
    1051     if (keysx) 
    1052         expandTuples(keysx); 
    1053     if (valuesx) 
    1054         expandTuples(valuesx); 
    1055     if ((keysx && keysx->dim != keys->dim) || 
    1056         (valuesx && valuesx->dim != values->dim)) 
    1057     {   delete keysx; 
    1058         delete valuesx; 
    1059         return EXP_CANT_INTERPRET; 
    1060     } 
    1061     AssocArrayLiteralExp *ae = new AssocArrayLiteralExp(loc, 
    1062         keysx ? keysx : keys, valuesx ? valuesx : values); 
     1031    if (keysx != keys) 
     1032    expandTuples(keysx); 
     1033    if (valuesx != values) 
     1034    expandTuples(valuesx); 
     1035    if (keysx->dim != valuesx->dim) 
     1036    goto Lerr; 
     1037 
     1038    /* Remove duplicate keys 
     1039     */ 
     1040    for (size_t i = 1; i < keysx->dim; i++) 
     1041    {   Expression *ekey = (Expression *)keysx->data[i - 1]; 
     1042 
     1043    for (size_t j = i; j < keysx->dim; j++) 
     1044    {   Expression *ekey2 = (Expression *)keysx->data[j]; 
     1045        Expression *ex = Equal(TOKequal, Type::tbool, ekey, ekey2); 
     1046        if (ex == EXP_CANT_INTERPRET) 
     1047        goto Lerr; 
     1048        if (ex->isBool(TRUE))   // if a match 
     1049        { 
     1050        // Remove ekey 
     1051        if (keysx == keys) 
     1052            keysx = (Expressions *)keys->copy(); 
     1053        if (valuesx == values) 
     1054            valuesx = (Expressions *)values->copy(); 
     1055        keysx->remove(i - 1); 
     1056        valuesx->remove(i - 1); 
     1057        i -= 1;     // redo the i'th iteration 
     1058        break; 
     1059        } 
     1060    } 
     1061    } 
     1062 
     1063    if (keysx != keys || valuesx != values) 
     1064    { 
     1065    AssocArrayLiteralExp *ae; 
     1066    ae = new AssocArrayLiteralExp(loc, keysx, valuesx); 
    10631067    ae->type = type; 
    10641068    return ae; 
    10651069    } 
    10661070    return this; 
     1071 
     1072Lerr: 
     1073    if (keysx != keys) 
     1074    delete keysx; 
     1075    if (valuesx != values) 
     1076    delete values; 
     1077    return EXP_CANT_INTERPRET; 
    10671078} 
    10681079 
     
    12011212    } 
    12021213    } 
    1203     if (e1 != EXP_CANT_INTERPRET && e1->op == TOKvar) 
     1214    if (e1 == EXP_CANT_INTERPRET) 
     1215    return e1; 
     1216    if (e1->op == TOKvar) 
    12041217    { 
    12051218    VarExp *ve = (VarExp *)e1; 
     
    14601473    if (e1 == EXP_CANT_INTERPRET) 
    14611474    goto Lcant; 
    1462     if (e1->op == TOKstring || e1->op == TOKarrayliteral
     1475    if (e1->op == TOKstring || e1->op == TOKarrayliteral || e1->op == TOKassocarrayliteral
    14631476    { 
    14641477    e = ArrayLength(type, e1); 
     
    14841497    goto Lcant; 
    14851498 
    1486     /* Set the $ variable 
    1487      */ 
    1488     e = ArrayLength(Type::tsize_t, e1); 
    1489     if (e == EXP_CANT_INTERPRET) 
    1490     goto Lcant; 
    1491     if (lengthVar) 
    1492     lengthVar->value = e; 
     1499    if (op == TOKstring || op == TOKarrayliteral) 
     1500    { 
     1501    /* Set the $ variable 
     1502     */ 
     1503    e = ArrayLength(Type::tsize_t, e1); 
     1504    if (e == EXP_CANT_INTERPRET) 
     1505        goto Lcant; 
     1506    if (lengthVar) 
     1507        lengthVar->value = e; 
     1508    } 
    14931509 
    14941510    e2 = this->e2->interpret(istate); 
  • trunk/rebuild/link.c

    r511 r522  
    11 
    22 
    3 // Copyright (c) 1999-2006 by Digital Mars 
     3// Copyright (c) 1999-2007 by Digital Mars 
    44// All Rights Reserved 
    55// written by Walter Bright 
     
    131131    return cline; 
    132132} 
    133  
     133   
    134134int runLINK() 
    135135{ 
     
    159159    else 
    160160    {   /* Generate exe file name from first sourcefile name, or object file 
    161          * name if that fails */ 
     161    * name if that fails */ 
    162162        char *n; 
    163163        if (global.cmodules && 
     
    171171            n = (char *)global.params.objfiles->data[0]; 
    172172         
    173    char *e; 
    174    char *ex; 
    175          
    176    n = FileName::name(n); 
    177    e = FileName::ext(n); 
    178    if (e) 
    179    
    180        e--;           // back up over '.' 
     173        char *e; 
     174        char *ex; 
     175         
     176        n = FileName::name(n); 
     177        e = FileName::ext(n); 
     178        if (e) 
     179       
     180            e--;          // back up over '.' 
    181181            out = string(n).substr(0, e - n); 
    182    
    183    else 
     182       
     183        else 
    184184        { 
    185185            out = "a.out"; 
     
    259259    return 0; 
    260260} 
    261  
     261   
    262262void runClean() 
    263263{ 
  • trunk/rebuild/mars.c

    r512 r522  
    5050 
    5151void getenv_setargv(const char *envvar, int *pargc, char** *pargv); 
     52void string_setargv(const char *, int *, char***); 
    5253 
    5354Global global; 
     
    6566    copyright = "Copyright (c) 1999-2007 by Digital Mars and Gregor Richards"; 
    6667    written = "written by Walter Bright and Gregor Richards"; 
    67     version = "version 0.62 (based on DMD 1.012)"; 
     68    version = "version 0.62 (based on DMD 1.013)"; 
    6869    global.structalign = 8; 
    6970    cmodules = NULL; 
     
    428429    } 
    429430     
    430     getenv_setargv("DFLAGS", &argc, &argv); 
     431    // get any arguments from $REBUILD_FLAGS... 
     432    getenv_setargv("REBUILD_FLAGS", &argc, &argv); 
     433     
     434    // and from $BUILD_FLAGS 
     435    getenv_setargv("BUILD_FLAGS", &argc, &argv); 
     436     
     437    // and from the configuration file 
     438    if (masterConfig.find("") != masterConfig.end() && 
     439        masterConfig[""].find("flags") != masterConfig[""].end()) { 
     440        string_setargv(masterConfig[""]["flags"].c_str(), &argc, &argv); 
     441    } 
    431442 
    432443#if 0 
     
    15961607 
    15971608 
     1609void string_setargv(const char *, int *, char***); 
    15981610 
    15991611/*********************************** 
     
    16061618{ 
    16071619    char *env; 
     1620    env = getenv(envvar); 
     1621    if (!env) 
     1622        return; 
     1623    string_setargv(env, pargc, pargv); 
     1624} 
     1625 
     1626 
     1627/*********************************** 
     1628 * Parse and append contents of a string 
     1629 * to argc and argv[]. 
     1630 * The string is separated into arguments, processing \ and ". 
     1631 */ 
     1632 
     1633void string_setargv(const char *string, int *pargc, char** *pargv) 
     1634{ 
     1635    char *env; 
    16081636    char *p; 
    16091637    Array *argv; 
     
    16161644    int j; 
    16171645 
    1618     env = getenv(envvar); 
    1619     if (!env) 
    1620     return; 
    1621  
    1622     env = mem.strdup(env);  // create our own writable copy 
     1646    env = mem.strdup(string);   // create our own writable copy 
    16231647 
    16241648    argc = *pargc; 
  • trunk/rebuild/mtype.c

    r459 r522  
    16761676} 
    16771677 
     1678Expression *semanticLength(Scope *sc, TupleDeclaration *s, Expression *exp) 
     1679{ 
     1680    ScopeDsymbol *sym = new ArrayScopeSymbol(s); 
     1681    sym->parent = sc->scopesym; 
     1682    sc = sc->push(sym); 
     1683 
     1684    exp = exp->semantic(sc); 
     1685 
     1686    sc->pop(); 
     1687    return exp; 
     1688} 
     1689 
    16781690void TypeSArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps) 
    16791691{ 
     
    17441756{ 
    17451757    //printf("TypeSArray::semantic() %s\n", toChars()); 
     1758 
     1759    Type *t; 
     1760    Expression *e; 
     1761    Dsymbol *s; 
     1762    next->resolve(loc, sc, &e, &t, &s); 
     1763    if (dim && s && s->isTupleDeclaration()) 
     1764    {   TupleDeclaration *sd = s->isTupleDeclaration(); 
     1765 
     1766    dim = semanticLength(sc, sd, dim); 
     1767    dim = dim->optimize(WANTvalue | WANTinterpret); 
     1768    uinteger_t d = dim->toUInteger(); 
     1769 
     1770    if (d >= sd->objects->dim) 
     1771    {   error(loc, "tuple index %ju exceeds %u", d, sd->objects->dim); 
     1772        return Type::terror; 
     1773    } 
     1774    Object *o = (Object *)sd->objects->data[(size_t)d]; 
     1775    if (o->dyncast() != DYNCAST_TYPE) 
     1776    {   error(loc, "%s is not a type", toChars()); 
     1777        return Type::terror; 
     1778    } 
     1779    t = (Type *)o; 
     1780    return t; 
     1781    } 
     1782 
    17461783    next = next->semantic(loc,sc); 
    17471784    Type *tbn = next->toBasetype(); 
     
    17611798        goto Loverflow; 
    17621799 
    1763     if (tbn->ty == Tbit && (d2 + 31) < d2) 
    1764         goto Loverflow; 
    1765     else if (tbn->isintegral() || 
     1800    if (tbn->isintegral() || 
    17661801         tbn->isfloating() || 
    17671802         tbn->ty == Tpointer || 
     
    22032238    FuncDeclaration *fd; 
    22042239    Expressions *arguments; 
    2205     char aakeys[7+3*sizeof(int)+1]; 
    22062240    int size = key->size(e->loc); 
    22072241 
    22082242    assert(size); 
    2209 #if 0 
    2210     if (size == 1 || size == 2 || size == 4 || size == 8) 
    2211     { 
    2212         sprintf(aakeys, "_aaKeys%d", size); 
    2213         size = 0; 
    2214     } 
    2215     else 
    2216 #endif 
    2217         strcpy(aakeys, "_aaKeys"); 
    2218     fd = FuncDeclaration::genCfunc(Type::tindex, aakeys); 
     2243    fd = FuncDeclaration::genCfunc(Type::tindex, "_aaKeys"); 
    22192244    ec = new VarExp(0, fd); 
    22202245    arguments = new Expressions(); 
    22212246    arguments->push(e); 
    2222     if (size) 
    2223         arguments->push(new IntegerExp(0, size, Type::tsize_t)); 
     2247    arguments->push(new IntegerExp(0, size, Type::tsize_t)); 
    22242248    e = new CallExp(e->loc, ec, arguments); 
    22252249    e->type = index->arrayOf(); 
  • trunk/rebuild/opover.c

    r459 r522  
    11 
    22// Compiler implementation of the D programming language 
    3 // Copyright (c) 1999-2006 by Digital Mars 
     3// Copyright (c) 1999-2007 by Digital Mars 
    44// All Rights Reserved 
    55// written by Walter Bright 
     
    2727#endif 
    2828 
    29 #include "port.h" 
     29//#include "port.h" 
    3030#include "mtype.h" 
    3131#include "init.h" 
  • trunk/rebuild/optimize.c

    r461 r522  
    265265    //printf("CastExp::optimize(result = %d) %s\n", result, toChars()); 
    266266    //printf("from %s to %s\n", type->toChars(), to->toChars()); 
     267    //printf("from %s\n", type->toChars()); 
    267268    //printf("type = %p\n", type); 
    268269    assert(type); 
    269  
    270     e1 = e1->optimize(result); 
     270    enum TOK op1 = e1->op; 
     271 
     272    e1 = e1->optimize(result); 
     273    if (result & WANTinterpret) 
     274    e1 = fromConstInitializer(e1); 
     275 
    271276    if ((e1->op == TOKstring || e1->op == TOKarrayliteral) && 
    272277    (type->ty == Tpointer || type->ty == Tarray) && 
     
    277282    return e1; 
    278283    } 
     284    /* The first test here is to prevent infinite loops 
     285     */ 
     286    if (op1 != TOKarrayliteral && e1->op == TOKarrayliteral) 
     287    return e1->castTo(NULL, to); 
    279288    if (e1->op == TOKnull && 
    280289    (type->ty == Tpointer || type->ty == Tclass)) 
     
    520529    e1 = e1->optimize(WANTvalue | (result & WANTinterpret)); 
    521530    e = this; 
    522     if (e1->op == TOKstring || e1->op == TOKarrayliteral
     531    if (e1->op == TOKstring || e1->op == TOKarrayliteral || e1->op == TOKassocarrayliteral
    523532    { 
    524533    e = ArrayLength(type, e1); 
  • trunk/rebuild/parse.c

    r459 r522  
    192192 
    193193        case TOKinvariant: 
     194#if 1 
     195        s = parseInvariant(); 
     196#else 
    194197        if (peek(&token)->value == TOKlcurly) 
    195198            s = parseInvariant(); 
     
    199202            goto Lstc; 
    200203        } 
     204#endif 
    201205        break; 
    202206 
     
    268272            case TOKsynchronized: stc |= STCsynchronized; goto Lstc; 
    269273            case TOKdeprecated:   stc |= STCdeprecated;  goto Lstc; 
    270             case TOKinvariant:    stc |= STCinvariant;   goto Lstc; 
     274            //case TOKinvariant:    stc |= STCinvariant;   goto Lstc; 
    271275            default: 
    272276            break; 
     
    20022006        } 
    20032007        v->storage_class = storage_class; 
    2004         a->push(v); 
     2008        if (link == linkage) 
     2009        a->push(v); 
     2010        else 
     2011        { 
     2012        Array *ax = new Array(); 
     2013        ax->push(v); 
     2014        Dsymbol *s = new LinkDeclaration(link, ax); 
     2015        a->push(s); 
     2016        } 
    20052017        switch (token.value) 
    20062018        {   case TOKsemicolon: 
     
    20622074        v = new VarDeclaration(loc, t, ident, init); 
    20632075        v->storage_class = storage_class; 
    2064         a->push(v); 
     2076        if (link == linkage) 
     2077        a->push(v); 
     2078        else 
     2079        { 
     2080        Array *ax = new Array(); 
     2081        ax->push(v); 
     2082        Dsymbol *s = new LinkDeclaration(link, ax); 
     2083        a->push(s); 
     2084        } 
    20652085        switch (token.value) 
    20662086        {   case TOKsemicolon: 
     
    23282348    case TOKvoid: 
    23292349        t = peek(&token); 
    2330         if (t->value == TOKsemicolon
     2350        if (t->value == TOKsemicolon || t->value == TOKcomma
    23312351        { 
    23322352        nextToken(); 
     
    39623982 
    39633983    case TOKlbracket: 
    3964     {   Expressions *elements = parseArguments(); 
    3965  
    3966         e = new ArrayLiteralExp(loc, elements); 
     3984    {   /* Parse array literals and associative array literals: 
     3985         *  [ value, value, value ... ] 
     3986         *  [ key:value, key:value, key:value ... ] 
     3987         */ 
     3988        Expressions *values = new Expressions(); 
     3989        Expressions *keys = NULL; 
     3990 
     3991        nextToken(); 
     3992        if (token.value != TOKrbracket) 
     3993        { 
     3994        while (1) 
     3995        { 
     3996            Expression *e = parseAssignExp(); 
     3997            if (token.value == TOKcolon && (keys || values->dim == 0)) 
     3998            {   nextToken(); 
     3999            if (!keys) 
     4000                keys = new Expressions(); 
     4001            keys->push(e); 
     4002            e = parseAssignExp(); 
     4003            } 
     4004            else if (keys) 
     4005            {   error("'key:value' expected for associative array literal"); 
     4006            delete keys; 
     4007            keys = NULL; 
     4008            } 
     4009            values->push(e); 
     4010            if (token.value == TOKrbracket) 
     4011            break; 
     4012            check(TOKcomma); 
     4013        } 
     4014        } 
     4015        check(TOKrbracket); 
     4016 
     4017        if (keys) 
     4018        e = new AssocArrayLiteralExp(loc, keys, values); 
     4019        else 
     4020        e = new ArrayLiteralExp(loc, values); 
    39674021        break; 
    39684022    } 
  • trunk/rebuild/port.h

    r272 r522  
    3535    static double dbl_min; 
    3636 
    37     static int isnan(double); 
    38     static int isfinite(double); 
    39     static int isinfinity(double); 
    40     static int signbit(double); 
     37#if __GNUC__ 
     38    // These conflict with macros in math.h, should rename them 
     39    #undef isnan 
     40    #undef isfinite 
     41    #undef isinfinity 
     42    #undef signbit 
     43#endif 
     44    static int isNan(double); 
     45    static int isFinite(double); 
     46    static int isInfinity(double); 
     47    static int Signbit(double); 
    4148 
    4249    static double floor(double); 
  • trunk/rebuild/statement.c

    r504 r522  
    24792479        fd->nrvo_can = 0; 
    24802480    } 
     2481    else 
     2482        fd->nrvo_can = 0; 
    24812483 
    24822484    if (fd->returnLabel && tbret->ty != Tvoid) 
  • trunk/sss/build.d

    r475 r522  
    8585            writefln("Creating imports for %s", target); 
    8686             
     87            // do the predigen 
     88            if ("predigen" in settings) { 
     89                dsssScriptedStep(conf, settings["predigen"]); 
     90            } 
     91             
    8792            // this is a library, so make .di files 
    8893            char[][] srcFiles = targetToFiles(build, conf); 
     
    122127                    } 
    123128                } 
     129            } 
     130             
     131            // do the postdigen 
     132            if ("postdigen" in settings) { 
     133                dsssScriptedStep(conf, settings["postdigen"]); 
    124134            } 
    125135