Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.55
 
1.56
 
MAIN:ragge:20030729091618
 
trees.c
_>487487             p->n_right->n_op == ICON)
 488488                 p->n_right->n_type = VOID;
 489489 
<> 490+if( bdebug ) fwalk( p, eprint, 0 );
490491         if( actions & CVTO ) p = oconvert(p);
 491492         p = clocal(p);
 492493 
     
 !
644645         t1 = p->n_left->n_type;
 645646         t2 = p->n_right->n_type;
 646647 
<>647 -        /* return of void allowed but nothing else */
 648 -        if (p->n_op == RETURN) {
  648+        switch (p->n_op) {
  649+        case RETURN:
  650+                /* return of void allowed but nothing else */
649651                 if (t1 == VOID && t2 == VOID)
 650652                         return;
 651653                 if (t1 == VOID)
 652654                         return uerror("returning value from void function");
 653655                 if (t2 == VOID)
 654656                         return uerror("using void value");
<> 657+        case COLON:
  658+                if (t1 == VOID && t2 == VOID)
  659+                        return;
  660+                break;
  661+        default:
  662+                if ((t1 == VOID && t2 != VOID) || (t1 != VOID && t2 == VOID))
  663+                        return uerror("value of void expression used");
  664+                break;
655665         }
 656666 
 657667         /* allow void pointer assignments in any direction */
     
 !
14511461 static void
 14521462 rmcops(NODE *p)
 14531463 {
<>1454 -#if 0
  1464+#if 1
14551465         NODE *q, *r;
 14561466         int o, ty, lbl, lbl2, tval;
 14571467 #else
     
 !
14711481         case BITYPE:
 14721482                 switch (o) {
 14731483                 case QUEST:
<>1474 -#if 0
  1484+
14751485                         /*
 14761486                          * Create a CBRANCH node from ?:
 14771487                          */
     
 !
14821492                         ecode(q); /* Done with branch! */
 14831493 
 14841494                         /* Make ASSIGN node */
<> 1495+                        /* Only if type is not void */
14851496                         q = p->n_right->n_left;
<>1486 -                        r = block(TEMP, NIL, NIL, q->n_type, q->n_df, q->n_sue);
 1487 -                        r->n_lval = tval;
 1488 -                        q = buildtree(ASSIGN, r, q);
  1497+                        if (p->n_type != VOID) {
  1498+                                r = block(TEMP, NIL, NIL,
  1499+                                    q->n_type, q->n_df, q->n_sue);
  1500+                                r->n_lval = tval;
  1501+                                q = buildtree(ASSIGN, r, q);
  1502+                        }
14891503                         rmcops(q);
 14901504                         ecode(q); /* Done with assign */
 14911505 
 14921506                         branch(lbl2 = getlab());
 14931507                         send_passt(IP_DEFLAB, lbl);
 14941508 
 14951509                         q = p->n_right->n_right;
<>1496 -                        r = block(TEMP, NIL, NIL, q->n_type, q->n_df, q->n_sue);
 1497 -                        r->n_lval = tval;
 1498 -                        q = buildtree(ASSIGN, r, q);
  1510+                        if (p->n_type != VOID) {
  1511+                                r = block(TEMP, NIL, NIL,
  1512+                                    q->n_type, q->n_df, q->n_sue);
  1513+                                r->n_lval = tval;
  1514+                                q = buildtree(ASSIGN, r, q);
  1515+                        }
14991516                         rmcops(q);
 15001517                         ecode(q); /* Done with assign */
 15011518 
 15021519                         send_passt(IP_DEFLAB, lbl2);
 15031520 
 15041521                         nfree(p->n_right);
<>1505 -                        p->n_op = TEMP;
  1522+                        if (p->n_type == VOID) {
  1523+                                p->n_op = ICON;
  1524+                                p->n_name = "";
  1525+                        } else
  1526+                                p->n_op = TEMP;
15061527                         p->n_lval = tval;
<>1507 -#endif
15081528                         break;
 15091529 
 15101530                 case ANDAND:
     
 !
15451565         walkf(p, prtdcon);
 15461566         send_passt(IP_LOCCTR, PROG);
 15471567         rmcops(p);
<>1548 -        ecode(p);
  1568+        if (p->n_op == ICON && p->n_type == VOID)
  1569+                tfree(p);
  1570+        else
  1571+                ecode(p);
<_15491572 }
 15501573 
 15511574 #ifdef STDPRTREE
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-08-20 14:41 +0200