Changeset 588
- Timestamp:
- 07/26/10 05:39:20 (14 years ago)
- Files:
-
- branches/dmd-1.x/src/backend/gother.c (modified) (2 diffs)
- branches/dmd-1.x/src/parse.c (modified) (1 diff)
- branches/dmd-1.x/src/parse.h (modified) (1 diff)
- trunk/src/backend/gother.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dmd-1.x/src/backend/gother.c
r493 r588 1 1 // Copyright (C) 1986-1998 by Symantec 2 // Copyright (C) 2000-20 09by Digital Mars2 // Copyright (C) 2000-2010 by Digital Mars 3 3 // All Rights Reserved 4 4 // http://www.digitalmars.com 5 5 // Written by Walter Bright 6 6 /* 7 7 * This source file is made available for personal use 8 8 * only. The license is in /dmd/src/dmd/backendlicense.txt 9 9 * or /dm/src/dmd/backendlicense.txt 10 10 * For any other uses, please contact Digital Mars. 11 11 */ 12 12 13 13 #if (SCPP || MARS) && !HTOD 14 14 15 15 #include <stdio.h> 16 16 #include <time.h> 17 17 18 18 #include "cc.h" 19 19 #include "global.h" 20 20 #include "el.h" 21 21 #include "go.h" 22 22 #include "oper.h" … … 463 463 464 464 //printf("checkprop: "); WReqn(n); printf("\n"); 465 465 assert(n && n->Eoper == OPvar); 466 466 elem_debug(n); 467 467 sv = n->EV.sp.Vsym; 468 468 assert(sytab[sv->Sclass] & SCRD); 469 469 nty = n->Ety; 470 470 if (!tyscalar(nty)) 471 471 goto noprop; 472 472 nsize = size(nty); 473 473 noff = n->EV.sp.Voffset; 474 474 unambig = sv->Sflags & SFLunambig; 475 475 for (l = rdlist; l; l = list_next(l)) 476 476 { elem *d = (elem *) list_ptr(l); 477 477 478 478 elem_debug(d); 479 479 480 480 //printf("\trd: "); WReqn(d); printf("\n"); 481 481 if (d->Eoper == OPasm) /* OPasm elems ruin everything */ 482 482 goto noprop; 483 #if 0 484 // Runs afoul of Buzilla 4506 483 485 if (OTassign(d->Eoper) && EBIN(d)) // if assignment elem 486 #else 487 if (OTassign(d->Eoper)) // if assignment elem 488 #endif 484 489 { elem *t = Elvalue(d); 485 490 486 491 if (t->Eoper == OPvar) 487 492 { assert(t->EV.sp.Vsym == sv); 488 493 489 494 if (d->Eoper == OPstreq || 490 495 !tyscalar(t->Ety)) 491 496 goto noprop; // not worth bothering with these cases 492 497 493 498 /* Everything must match or we must skip this variable */ 494 499 /* (in case of assigning to overlapping unions, etc.) */ 495 500 if (t->EV.sp.Voffset != noff || 496 501 /* If sizes match, we are ok */ 497 502 size(t->Ety) != nsize && 498 503 !(d->E2->Eoper == OPconst && size(t->Ety) > nsize && !tyfloating(d->E2->Ety))) 499 504 goto noprop; 500 505 } 501 506 else 502 507 { if (unambig) /* unambiguous assignments only */ 503 508 continue; branches/dmd-1.x/src/parse.c
r585 r588 5443 5443 else if (token.value == TOKlparen) 5444 5444 arguments = parseArguments(); 5445 5445 #endif 5446 5446 e = new NewExp(loc, thisexp, newargs, t, arguments); 5447 5447 return e; 5448 5448 } 5449 5449 5450 5450 /********************************************** 5451 5451 */ 5452 5452 5453 5453 void Parser::addComment(Dsymbol *s, unsigned char *blockComment) 5454 5454 { 5455 5455 s->addComment(combineComments(blockComment, token.lineComment)); 5456 5456 token.lineComment = NULL; 5457 5457 } 5458 5458 5459 5459 /********************************** 5460 5460 * Set operator precedence for each operator. 5461 5461 */ 5462 5462 5463 enum PREC precedence[TOKMAX]; 5464 5463 5465 void initPrecedence() 5464 5466 { 5465 5467 precedence[TOKdotvar] = PREC_primary; 5466 5468 precedence[TOKimport] = PREC_primary; 5467 5469 precedence[TOKidentifier] = PREC_primary; 5468 5470 precedence[TOKthis] = PREC_primary; 5469 5471 precedence[TOKsuper] = PREC_primary; 5470 5472 precedence[TOKint64] = PREC_primary; 5471 5473 precedence[TOKfloat64] = PREC_primary; 5472 5474 precedence[TOKnull] = PREC_primary; 5473 5475 precedence[TOKstring] = PREC_primary; 5474 5476 precedence[TOKarrayliteral] = PREC_primary; 5475 5477 precedence[TOKtypeid] = PREC_primary; 5476 5478 precedence[TOKis] = PREC_primary; 5477 5479 precedence[TOKassert] = PREC_primary; 5478 5480 precedence[TOKfunction] = PREC_primary; 5479 5481 precedence[TOKvar] = PREC_primary; 5480 5482 #if DMDV2 5481 5483 precedence[TOKdefault] = PREC_primary; 5482 5484 #endif branches/dmd-1.x/src/parse.h
r585 r588 148 148 enum PREC 149 149 { 150 150 PREC_zero, 151 151 PREC_expr, 152 152 PREC_assign, 153 153 PREC_cond, 154 154 PREC_oror, 155 155 PREC_andand, 156 156 PREC_or, 157 157 PREC_xor, 158 158 PREC_and, 159 159 PREC_equal, 160 160 PREC_rel, 161 161 PREC_shift, 162 162 PREC_add, 163 163 PREC_mul, 164 164 PREC_unary, 165 165 PREC_primary, 166 166 }; 167 167 168 e num PREC precedence[TOKMAX];168 extern enum PREC precedence[TOKMAX]; 169 169 170 170 void initPrecedence(); 171 171 172 172 #endif /* DMD_PARSE_H */ trunk/src/backend/gother.c
r490 r588 1 1 // Copyright (C) 1986-1998 by Symantec 2 // Copyright (C) 2000-20 09by Digital Mars2 // Copyright (C) 2000-2010 by Digital Mars 3 3 // All Rights Reserved 4 4 // http://www.digitalmars.com 5 5 // Written by Walter Bright 6 6 /* 7 7 * This source file is made available for personal use 8 8 * only. The license is in /dmd/src/dmd/backendlicense.txt 9 9 * or /dm/src/dmd/backendlicense.txt 10 10 * For any other uses, please contact Digital Mars. 11 11 */ 12 12 13 13 #if (SCPP || MARS) && !HTOD 14 14 15 15 #include <stdio.h> 16 16 #include <time.h> 17 17 18 18 #include "cc.h" 19 19 #include "global.h" 20 20 #include "el.h" 21 21 #include "go.h" 22 22 #include "oper.h" … … 463 463 464 464 //printf("checkprop: "); WReqn(n); printf("\n"); 465 465 assert(n && n->Eoper == OPvar); 466 466 elem_debug(n); 467 467 sv = n->EV.sp.Vsym; 468 468 assert(sytab[sv->Sclass] & SCRD); 469 469 nty = n->Ety; 470 470 if (!tyscalar(nty)) 471 471 goto noprop; 472 472 nsize = size(nty); 473 473 noff = n->EV.sp.Voffset; 474 474 unambig = sv->Sflags & SFLunambig; 475 475 for (l = rdlist; l; l = list_next(l)) 476 476 { elem *d = (elem *) list_ptr(l); 477 477 478 478 elem_debug(d); 479 479 480 480 //printf("\trd: "); WReqn(d); printf("\n"); 481 481 if (d->Eoper == OPasm) /* OPasm elems ruin everything */ 482 482 goto noprop; 483 #if 0 484 // Runs afoul of Buzilla 4506 483 485 if (OTassign(d->Eoper) && EBIN(d)) // if assignment elem 486 #else 487 if (OTassign(d->Eoper)) // if assignment elem 488 #endif 484 489 { elem *t = Elvalue(d); 485 490 486 491 if (t->Eoper == OPvar) 487 492 { assert(t->EV.sp.Vsym == sv); 488 493 489 494 if (d->Eoper == OPstreq || 490 495 !tyscalar(t->Ety)) 491 496 goto noprop; // not worth bothering with these cases 492 497 493 498 /* Everything must match or we must skip this variable */ 494 499 /* (in case of assigning to overlapping unions, etc.) */ 495 500 if (t->EV.sp.Voffset != noff || 496 501 /* If sizes match, we are ok */ 497 502 size(t->Ety) != nsize && 498 503 !(d->E2->Eoper == OPconst && size(t->Ety) > nsize && !tyfloating(d->E2->Ety))) 499 504 goto noprop; 500 505 } 501 506 else 502 507 { if (unambig) /* unambiguous assignments only */ 503 508 continue;
