Changeset 800

Show
Ignore:
Timestamp:
09/06/07 12:06:07 (1 year ago)
Author:
Gregor
Message:

rebuild/*: A few improvements (I hope).

sss/build.d: Fixed multi-compiler stuff.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/rebuild/attrib.c

    r785 r800  
    833833 
    834834        e = e->semantic(sc); 
     835                e = e->optimize(WANTvalue | WANTinterpret); 
    835836        if (e->op == TOKstring) 
    836837        { 
     
    854855                 
    855856        e = e->semantic(sc); 
     857                e = e->optimize(WANTvalue | WANTinterpret); 
    856858        if (e->op == TOKstring) 
    857859        { 
  • trunk/rebuild/parse.c

    r798 r800  
    7272    nextToken(); 
    7373    if (token.value != TOKidentifier) 
    74     {   // error("Identifier expected following module"); 
     74    {   error("Identifier expected following module"); 
    7575        goto Lerr; 
    7676    } 
     
    8888        nextToken(); 
    8989        if (token.value != TOKidentifier) 
    90         {   // error("Identifier expected following package"); 
     90        {   error("Identifier expected following package"); 
    9191            goto Lerr; 
    9292        } 
     
    9696        md = new ModuleDeclaration(a, id); 
    9797 
    98         /* if (token.value != TOKsemicolon) 
    99         error("';' expected following module declaration instead of %s", token.toChars()); */ 
     98        if (token.value != TOKsemicolon) 
     99        error("';' expected following module declaration instead of %s", token.toChars()); 
    100100        nextToken(); 
    101101        addComment(mod, comment); 
     
    105105    decldefs = parseDeclDefs(0); 
    106106    if (token.value != TOKeof) 
    107     {   // error("unrecognized declaration"); 
     107    {   error("unrecognized declaration"); 
    108108    goto Lerr; 
    109109    } 
     
    333333                continue; 
    334334                } 
    335                 /* else 
    336                 error("Identifier expected following comma"); * */ 
     335                else 
     336                error("Identifier expected following comma"); 
    337337            } 
    338             /* else 
    339                 error("semicolon expected following auto declaration, not '%s'", token.toChars()); */ 
     338            else 
     339                error("semicolon expected following auto declaration, not '%s'", token.toChars()); 
    340340            break; 
    341341            } 
     
    383383            n = (unsigned)token.uns64value; 
    384384            else 
    385             {   //  error("integer expected, not %s", token.toChars()); 
     385            {   error("integer expected, not %s", token.toChars()); 
    386386            n = 1; 
    387387            } 
     
    404404        check(TOKlparen); 
    405405        if (token.value != TOKidentifier) 
    406         {   // error("pragma(identifier expected"); 
     406        {   error("pragma(identifier expected"); 
    407407            goto Lerror; 
    408408        } 
     
    432432            s = new DebugSymbol(loc, (unsigned)token.uns64value); 
    433433            else 
    434             {   // error("identifier or integer expected, not %s", token.toChars()); 
     434            {   error("identifier or integer expected, not %s", token.toChars()); 
    435435            s = NULL; 
    436436            } 
    437437            nextToken(); 
    438             /* if (token.value != TOKsemicolon) 
    439             error("semicolon expected"); */ 
     438            if (token.value != TOKsemicolon) 
     439            error("semicolon expected"); 
    440440            nextToken(); 
    441441            break; 
     
    455455            s = new VersionSymbol(loc, (unsigned)token.uns64value); 
    456456            else 
    457             {   // error("identifier or integer expected, not %s", token.toChars()); 
     457            {   error("identifier or integer expected, not %s", token.toChars()); 
    458458            s = NULL; 
    459459            } 
    460460            nextToken(); 
    461             /* if (token.value != TOKsemicolon) 
    462             error("semicolon expected"); */ 
     461            if (token.value != TOKsemicolon) 
     462            error("semicolon expected"); 
    463463            nextToken(); 
    464464            break; 
     
    512512    { 
    513513    case TOKsemicolon: 
    514         // error("declaration expected following attribute, not ';'"); 
     514        error("declaration expected following attribute, not ';'"); 
    515515        nextToken(); 
    516516        break; 
     
    521521        if (token.value != TOKrcurly) 
    522522        {   /* { */ 
    523         // error("matching '}' expected, not %s", token.toChars()); 
     523        error("matching '}' expected, not %s", token.toChars()); 
    524524        } 
    525525        else 
     
    606606    else 
    607607    { 
    608         // error("valid linkage identifiers are D, C, C++, Pascal, Windows, System"); 
     608        error("valid linkage identifiers are D, C, C++, Pascal, Windows, System"); 
    609609        link = LINKd; 
    610610    } 
     
    636636    else if (token.value == TOKint32v) 
    637637        level = (unsigned)token.uns64value; 
    638     /* else 
    639         error("identifier or integer expected, not %s", token.toChars()); */ 
     638    else 
     639        error("identifier or integer expected, not %s", token.toChars()); 
    640640    nextToken(); 
    641641    check(TOKrparen); 
     
    665665    else if (token.value == TOKint32v) 
    666666        level = (unsigned)token.uns64value; 
    667     /* else 
    668         error("identifier or integer expected, not %s", token.toChars()); */ 
     667    else 
     668        error("identifier or integer expected, not %s", token.toChars()); 
    669669    nextToken(); 
    670670    check(TOKrparen); 
    671671 
    672672    } 
    673     /* else 
    674        error("(condition) expected following version"); */ 
     673    else 
     674       error("(condition) expected following version"); 
    675675    c = new VersionCondition(mod, level, id); 
    676676    return c; 
     
    700700    } 
    701701    else 
    702     {   // error("(expression) expected following static if"); 
     702    {   error("(expression) expected following static if"); 
    703703    exp = NULL; 
    704704    } 
     
    870870    nextToken(); 
    871871    arguments = parseParameters(&varargs); 
    872     /* if (varargs) 
    873     error("... not allowed in delete function parameter list"); */ 
     872    if (varargs) 
     873    error("... not allowed in delete function parameter list"); 
    874874    f = new DeleteDeclaration(loc, 0, arguments); 
    875875    parseContracts(f); 
     
    10641064        } 
    10651065        else 
    1066         {   // error("enum member expected"); 
     1066        {   error("enum member expected"); 
    10671067        nextToken(); 
    10681068        } 
     
    10701070    nextToken(); 
    10711071    } 
    1072     /* else 
    1073     error("enum declaration is invalid"); */ 
     1072    else 
     1073    error("enum declaration is invalid"); 
    10741074 
    10751075    return e; 
     
    11161116        baseclasses = parseBaseClasses(); 
    11171117 
    1118         /* if (token.value != TOKlcurly) 
    1119             error("members expected"); */ 
     1118        if (token.value != TOKlcurly) 
     1119            error("members expected"); 
    11201120        } 
    11211121 
     
    11531153    nextToken(); 
    11541154    Array *decl = parseDeclDefs(0); 
    1155     /* if (token.value != TOKrcurly) 
    1156         error("} expected following member declarations in aggregate"); */ 
     1155    if (token.value != TOKrcurly) 
     1156        error("} expected following member declarations in aggregate"); 
    11571157    nextToken(); 
    11581158    if (anon) 
     
    11671167    else 
    11681168    { 
    1169     // error("{ } expected following aggregate declaration"); 
     1169    error("{ } expected following aggregate declaration"); 
    11701170    a = new StructDeclaration(loc, NULL); 
    11711171    } 
     
    12381238    nextToken(); 
    12391239    if (token.value != TOKidentifier) 
    1240     {   // error("TemplateIdentifier expected following template"); 
     1240    {   error("TemplateIdentifier expected following template"); 
    12411241    goto Lerr; 
    12421242    } 
     
    12481248 
    12491249    if (token.value != TOKlcurly) 
    1250     {   // error("members of template declaration expected"); 
     1250    {   error("members of template declaration expected"); 
    12511251    goto Lerr; 
    12521252    } 
     
    12561256    decldefs = parseDeclDefs(0); 
    12571257    if (token.value != TOKrcurly) 
    1258     {   // error("template member expected"); 
     1258    {   error("template member expected"); 
    12591259        goto Lerr; 
    12601260    } 
     
    12781278 
    12791279    if (token.value != TOKlparen) 
    1280     {   // error("parenthesized TemplateParameterList expected following TemplateIdentifier"); 
     1280    {   error("parenthesized TemplateParameterList expected following TemplateIdentifier"); 
    12811281    goto Lerr; 
    12821282    } 
     
    13061306        nextToken(); 
    13071307        if (token.value != TOKidentifier) 
    1308         {   // error("Identifier expected for template parameter"); 
     1308        {   error("Identifier expected for template parameter"); 
    13091309            goto Lerr; 
    13101310        } 
     
    13271327        {   // TypeParameter 
    13281328        if (token.value != TOKidentifier) 
    1329         {   // error("Identifier expected for template parameter"); 
     1329        {   error("Identifier expected for template parameter"); 
    13301330            goto Lerr; 
    13311331        } 
     
    13461346        else if (token.value == TOKidentifier && t->value == TOKdotdotdot) 
    13471347        {   // ident... 
    1348         /* if (isvariadic) 
    1349             error("variadic template parameter must be last"); */ 
     1348        if (isvariadic) 
     1349            error("variadic template parameter must be last"); 
    13501350        isvariadic = 1; 
    13511351        tp_ident = token.ident; 
     
    13591359        if (!tp_ident) 
    13601360        { 
    1361             // error("no identifier for template value parameter"); 
     1361            error("no identifier for template value parameter"); 
    13621362            goto Lerr; 
    13631363        } 
     
    14251425    if (token.value != TOKidentifier) 
    14261426    { 
    1427         // error("identifier expected, not %s", token.toChars()); 
     1427        error("identifier expected, not %s", token.toChars()); 
    14281428        goto Lerr; 
    14291429    } 
     
    14551455    nextToken(); 
    14561456    if (token.value != TOKidentifier) 
    1457     {   // error("identifier expected following '.' instead of '%s'", token.toChars()); 
     1457    {   error("identifier expected following '.' instead of '%s'", token.toChars()); 
    14581458        break; 
    14591459    } 
     
    14721472 
    14731473    tm = new TemplateMixin(loc, id, tqual, idents, tiargs); 
    1474     /* if (token.value != TOKsemicolon) 
    1475     error("';' expected after mixin"); */ 
     1474    if (token.value != TOKsemicolon) 
     1475    error("';' expected after mixin"); 
    14761476    nextToken(); 
    14771477 
     
    14941494    //printf("Parser::parseTemplateArgumentList()\n"); 
    14951495    if (token.value != TOKlparen) 
    1496     {   // error("!(TemplateArgumentList) expected following TemplateIdentifier"); 
     1496    {   error("!(TemplateArgumentList) expected following TemplateIdentifier"); 
    14971497    return new Objects(); 
    14981498    } 
     
    15481548    nextToken(); 
    15491549    if (token.value != TOKidentifier) 
    1550     {   // error("Identifier expected following import"); 
     1550    {   error("Identifier expected following import"); 
    15511551        break; 
    15521552    } 
     
    15681568        nextToken(); 
    15691569        if (token.value != TOKidentifier) 
    1570         {   // error("Identifier expected following package"); 
     1570        {   error("Identifier expected following package"); 
    15711571        break; 
    15721572        } 
     
    15901590        nextToken(); 
    15911591        if (token.value != TOKidentifier) 
    1592         {   // error("Identifier expected following :"); 
     1592        {   error("Identifier expected following :"); 
    15931593            break; 
    15941594        } 
     
    15991599            nextToken(); 
    16001600            if (token.value != TOKidentifier) 
    1601             {   // error("Identifier expected following %s=", alias->toChars()); 
     1601            {   error("Identifier expected following %s=", alias->toChars()); 
    16021602            break; 
    16031603            } 
     
    16211621    else 
    16221622    { 
    1623     // error("';' expected"); 
     1623    error("';' expected"); 
    16241624    nextToken(); 
    16251625    } 
     
    16851685        {   nextToken(); 
    16861686        if (token.value != TOKidentifier) 
    1687         {   // error("identifier expected following '.' instead of '%s'", token.toChars()); 
     1687        {   error("identifier expected following '.' instead of '%s'", token.toChars()); 
    16881688            break; 
    16891689        } 
     
    17371737 
    17381738    default: 
    1739         // error("basic type expected, not %s", token.toChars()); 
     1739        error("basic type expected, not %s", token.toChars()); 
    17401740        t = Type::tint32; 
    17411741        break; 
     
    20282028        if (!(token.value == TOKidentifier && peek(&token)->value == TOKassign)) 
    20292029        { 
    2030         // error("Identifier expected following comma"); 
     2030        error("Identifier expected following comma"); 
    20312031        } 
    20322032        else 
    20332033        continue; 
    20342034    } 
    2035     /* else 
    2036         error("semicolon expected following auto declaration, not '%s'", token.toChars()); */ 
     2035    else 
     2036        error("semicolon expected following auto declaration, not '%s'", token.toChars()); 
    20372037    return a; 
    20382038    } 
     
    20652065        error("multiple declarations must have the same type, not %s and %s", 
    20662066        tfirst->toChars(), t->toChars()); */ 
    2067     /* if (!ident) 
    2068         error("no identifier for declarator %s", t->toChars()); */ 
     2067    if (!ident) 
     2068        error("no identifier for declarator %s", t->toChars()); 
    20692069 
    20702070    if (tok == TOKtypedef || tok == TOKalias) 
     
    21072107 
    21082108        default: 
    2109             // error("semicolon expected to close %s declaration", Token::toChars(tok)); 
     2109            error("semicolon expected to close %s declaration", Token::toChars(tok)); 
    21102110            break; 
    21112111        } 
     
    21752175 
    21762176        default: 
    2177             // error("semicolon expected, not '%s'", token.toChars()); 
     2177            error("semicolon expected, not '%s'", token.toChars()); 
    21782178            break; 
    21792179        } 
     
    22002200    { 
    22012201    case TOKlcurly: 
    2202         /* if (f->frequire || f->fensure) 
    2203         error("missing body { ... } after in or out"); */ 
     2202        if (f->frequire || f->fensure) 
     2203        error("missing body { ... } after in or out"); 
    22042204        f->fbody = parseStatement(PSsemi); 
    22052205        f->endloc = endloc; 
     
    22132213 
    22142214    case TOKsemicolon: 
    2215         /* if (f->frequire || f->fensure) 
    2216         error("missing body { ... } after in or out"); */ 
     2215        if (f->frequire || f->fensure) 
     2216        error("missing body { ... } after in or out"); 
    22172217        nextToken(); 
    22182218        break; 
     
    22582258        { 
    22592259        check(TOKlparen); 
    2260         /* if (token.value != TOKidentifier)      
    2261             error("(identifier) following 'out' expected, not %s", token.toChars()); */ 
     2260        if (token.value != TOKidentifier)     
     2261            error("(identifier) following 'out' expected, not %s", token.toChars()); 
    22622262        f->outId = token.ident; 
    22632263        nextToken(); 
     
    22702270 
    22712271    default: 
    2272         // error("semicolon expected following function declaration"); 
     2272        error("semicolon expected following function declaration"); 
    22732273        break; 
    22742274    } 
     
    24592459    //printf("parseStatement()\n"); 
    24602460 
    2461     /* if (flags & PScurly && token.value != TOKlcurly) 
    2462     error("statement expected to be { }, not %s", token.toChars()); */ 
     2461    if (flags & PScurly && token.value != TOKlcurly) 
     2462    error("statement expected to be { }, not %s", token.toChars()); 
    24632463 
    24642464    switch (token.value) 
     
    27552755        } 
    27562756        at = parseType(&ai); 
    2757         /* if (!ai) 
    2758             error("no identifier for declarator %s", at->toChars()); */ 
     2757        if (!ai) 
     2758            error("no identifier for declarator %s", at->toChars()); 
    27592759          Larg: 
    27602760        a = new Argument(storageClass, at, ai, NULL); 
     
    32393239            case TOKeof: 
    32403240            /* { */ 
    3241             // error("matching '}' expected, not end of file"); 
     3241            error("matching '}' expected, not end of file"); 
    32423242            break; 
    32433243 
     
    32843284void Parser::check(Loc loc, enum TOK value) 
    32853285{ 
    3286     /* if (token.value != value) 
    3287     error(loc, "found '%s' when expecting '%s'", token.toChars(), Token::toChars(value)); */ 
     3286    if (token.value != value) 
     3287    error(loc, "found '%s' when expecting '%s'", token.toChars(), Token::toChars(value)); 
    32883288    nextToken(); 
    32893289} 
     
    32913291void Parser::check(enum TOK value, char *string) 
    32923292{ 
    3293     /* if (token.value != value) 
     3293    if (token.value != value) 
    32943294    error("found '%s' when expecting '%s' following '%s'", 
    3295         token.toChars(), Token::toChars(value), string); */ 
     3295        token.toChars(), Token::toChars(value), string); 
    32963296    nextToken(); 
    32973297} 
     
    39843984        check(TOKdot, t->toChars()); 
    39853985        if (token.value != TOKidentifier) 
    3986         {   // error("found '%s' when expecting identifier following '%s.'", token.toChars(), t->toChars()); 
     3986        {   error("found '%s' when expecting identifier following '%s.'", token.toChars(), t->toChars()); 
    39873987        goto Lerr; 
    39883988        } 
     
    42614261            continue; 
    42624262        } 
    4263         /* else 
    4264             error("identifier expected following '.', not '%s'", token.toChars()); */ 
     4263        else 
     4264            error("identifier expected following '.', not '%s'", token.toChars()); 
    42654265        break; 
    42664266 
     
    44834483                nextToken(); 
    44844484                if (token.value != TOKidentifier) 
    4485                 {   // error("Identifier expected following (type)."); 
     4485                {   error("Identifier expected following (type)."); 
    44864486                return NULL; 
    44874487                } 
     
    49714971 
    49724972    if (token.value != TOKlcurly) 
    4973     {   // error("{ members } expected for anonymous class"); 
     4973    {   error("{ members } expected for anonymous class"); 
    49744974        cd->members = NULL; 
    49754975    } 
     
    49784978        nextToken(); 
    49794979        Array *decl = parseDeclDefs(0); 
    4980         /* if (token.value != TOKrcurly) 
    4981         error("class member expected"); */ 
     4980        if (token.value != TOKrcurly) 
     4981        error("class member expected"); 
    49824982        nextToken(); 
    49834983        cd->members = decl; 
  • trunk/rebuild/statement.c

    r785 r800  
    20302030 
    20312031        e = e->semantic(sc); 
     2032                e = e->optimize(WANTvalue | WANTinterpret); 
    20322033        if (e->op == TOKstring) 
    20332034        { 
     
    20352036                    linkLibrary((char *) se->string); 
    20362037        } 
    2037         /* else 
    2038             error("string expected for link, not '%s'", e->toChars()); */ 
     2038        else 
     2039            error("string expected for link, not '%s'", e->toChars()); 
    20392040        } 
    20402041    } 
     
    20502051                 
    20512052        e = e->semantic(sc); 
     2053                e = e->optimize(WANTvalue | WANTinterpret); 
    20522054        if (e->op == TOKstring) 
    20532055        { 
     
    20592061                    toadd = e->toChars(); 
    20602062                } 
    2061                 /* else 
    2062                     error("string or identifier expected for export_version, not '%s'", e->toChars()); */ 
     2063                else 
     2064                    error("string or identifier expected for export_version, not '%s'", e->toChars()); 
    20632065                 
    20642066                /* add this version flag to our own idea of versions, as 
  • trunk/sss/build.d

    r799 r800  
    113113                        debugPrefix = "debug-"; 
    114114                     
    115                     // generate the pragmas 
     115                    /* generate the pragmas (FIXME: this should be done in a 
     116                     * nicer way) */ 
    116117                    char[] defaultLibName = libraryName(build); 
    117118                    if (defaultLibName == target) { 
    118119                        std.file.write(ifile, std.file.read(file) ~ ` 
    119 import sss.platform; 
    120120version (build) { 
    121121    debug { 
    122         pragma(link, "` ~ debugPrefix ~ `D" ~ DSSS_PLATFORM ~ "` ~ target[2..$] ~ `"); 
     122        version (GNU) { 
     123            pragma(link, "` ~ debugPrefix ~ `DG` ~ target[2..$] ~ `"); 
     124        } else version (DigitalMars) { 
     125            pragma(link, "` ~ debugPrefix ~ `DD` ~ target[2..$] ~ `"); 
     126        } else { 
     127            pragma(link, "` ~ debugPrefix ~ `DO` ~ target[2..$] ~ `"); 
     128        } 
    123129    } else { 
    124         pragma(link, "D" ~ DSSS_PLATFORM ~ "` ~ target[2..$] ~ `"); 
     130        version (GNU) { 
     131            pragma(link, "DG` ~ target[2..$] ~ `"); 
     132        } else version (DigitalMars) { 
     133            pragma(link, "DD` ~ target[2..$] ~ `"); 
     134        } else { 
     135            pragma(link, "DO` ~ target[2..$] ~ `"); 
     136        } 
    125137    } 
    126138}