Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.67
 
1.68
 
MAIN:ragge:20030802162334
 
trees.c
_>119119         char *name;
 120120         struct symtab **elem;
 121121 
<>122 -# ifndef BUG1
  122+#ifdef PCC_DEBUG
123123         if (bdebug)
 124124                 printf("buildtree(%s, %p, %p)\n", copst(o), l, r);
<>125 -# endif
  125+#endif
126126         opty = coptype(o);
 127127 
 128128         /* check for constants */
     
 !
244244         if (actions & LVAL) { /* check left descendent */
 245245                 if (notlval(p->n_left)) {
 246246                         uerror("lvalue required");
<> 247+#ifdef notyet
247248                 } else {
 248249                         if ((l->n_type > BTMASK && ISCON(l->n_qual)) ||
 249250                             (l->n_type <= BTMASK && ISCON(l->n_qual << TSHIFT)))
 250251                                 if (blevel > 0)
 251252                                         uerror("lvalue is declared const");
<> 253+#endif
252254                 }
 253255         }
 254256 
     
 !
379381                                 p = l->n_left;
 380382                                 nfree(l);
 381383                         case NAME:
<>382 -                                p->n_type = INCREF( l->n_type );
  384+                                p->n_type = INCREF(l->n_type);
  385+                                p->n_qual = INCQAL(l->n_qual);
383386                                 p->n_df = l->n_df;
 384387                                 p->n_sue = l->n_sue;
 385388                                 break;
 386389 
 387390                         case COMOP:
 388391                                 nfree(p);
<>389 -                                lr = buildtree( UNARY AND, l->n_right, NIL );
  392+                                lr = buildtree(UNARY AND, l->n_right, NIL);
390393                                 p = buildtree( COMOP, l->n_left, lr );
 391394                                 nfree(l);
 392395                                 break;
     
 !
410413                 case ASG LS:
 411414                 case ASG RS:
 412415                         if(tsize(p->n_right->n_type, p->n_right->n_df, p->n_right->n_sue) > SZINT)
<>413 -                                p->n_right = r = makety(r, INT, 0, MKSUE(INT));
  416+                                p->n_right = r = makety(r, INT, 0, 0, MKSUE(INT));
414417                         break;
 415418 
 416419                 case RETURN:
     
 !
497500             p->n_right->n_op == ICON)
 498501                 p->n_right->n_type = VOID;
 499502 
<>500 -if( bdebug ) fwalk( p, eprint, 0 );
 501 -        if( actions & CVTO ) p = oconvert(p);
  503+        if (actions & CVTO)
  504+                p = oconvert(p);
502505         p = clocal(p);
 503506 
 504507 #ifdef PCC_DEBUG
<>505 -        if( bdebug ) fwalk( p, eprint, 0 );
  508+        if (bdebug)
  509+                fwalk(p, eprint, 0);
506510 #endif
 507511 
 508512         return(p);
     
 !
745749         NODE *r;
 746750         struct suedef *sue;
 747751         union dimfun *d;
<>748 -        TWORD t;
  752+        TWORD t, q;
749753         int dsc;
 750754         OFFSZ off;
<>751 -        register struct symtab *q;
  755+        struct symtab *s;
752756 
 753757         /* make p->x */
 754758         /* this is also used to reference automatic variables */
 755759 
<>756 -        q = p->n_right->n_sp;
  760+        s = p->n_right->n_sp;
757761         nfree(p->n_right);
 758762         r = p->n_left;
 759763         nfree(p);
     
 !
764768         if (!ISPTR(p->n_type))
 765769                 p->n_type = PTR+UNIONTY;
 766770 
<>767 -        t = INCREF(q->stype);
 768 -        d = q->sdf;
 769 -        sue = q->ssue;
  771+        t = INCREF(s->stype);
  772+        q = INCQAL(s->squal);
  773+        d = s->sdf;
  774+        sue = s->ssue;
770775 
<>771 -        p = makety(p, t, d, sue);
  776+        p = makety(p, t, q, d, sue);
772777 
 773778         /* compute the offset to be added */
 774779 
<>775 -        off = q->soffset;
 776 -        dsc = q->sclass;
  780+        off = s->soffset;
  781+        dsc = s->sclass;
777782 
 778783         if (dsc & FIELD) {  /* make fields look like ints */
 779784                 off = (off/ALINT)*ALINT;
 780785                 sue = MKSUE(INT);
 781786         }
<>782 -        if (off != 0)
 783 -                p = clocal(block(PLUS, p, offcon(off, t, d, sue), t, d, sue));
  787+        if (off != 0) {
  788+                p = block(PLUS, p, offcon(off, t, d, sue), t, d, sue);
  789+                p->n_qual = q;
  790+                p = clocal(p);
  791+        }
784792 
 785793         p = buildtree(UNARY MUL, p, NIL);
 786794 
 787795         /* if field, build field info */
 788796 
 789797         if (dsc & FIELD) {
<>790 -                p = block(FLD, p, NIL, q->stype, 0, q->ssue);
 791 -                p->n_rval = PKFIELD(dsc&FLDSIZ, q->soffset%ALINT);
  798+                p = block(FLD, p, NIL, s->stype, 0, s->ssue);
  799+                p->n_qual = q;
  800+                p->n_rval = PKFIELD(dsc&FLDSIZ, s->soffset%ALINT);
792801         }
 793802 
 794803         p = clocal(p);
     
 !
885894         return(p);
 886895 }
 887896 
<> 897+/*
  898+ * change enums to ints, or appropriate types
  899+ */
888900 void
 889901 econvert( p ) register NODE *p; {
 890902 
<>891 -        /* change enums to ints, or appropriate types */
892903 
 893904         register TWORD ty;
 894905 
     
 !
952963         return(p);
 953964         }
 954965 
<> 966+/*
  967+ * makes the operands of p agree; they are
  968+ * either pointers or integers, by this time
  969+ * with MINUS, the sizes must be the same
  970+ * with COLON, the types must be the same
  971+ */
955972 NODE *
<>956 -ptmatch(p)  register NODE *p; {
 957 -
 958 -        /* makes the operands of p agree; they are
 959 -           either pointers or integers, by this time */
 960 -        /* with MINUS, the sizes must be the same */
 961 -        /* with COLON, the types must be the same */
 962 -
  973+ptmatch(NODE *p)
  974+{
963975         struct suedef *sue, *sue2;
 964976         union dimfun *d, *d2;
<>965 -        TWORD t1, t2, t;
  977+        TWORD t1, t2, t, q1, q2, q;
966978         int o;
 967979 
 968980         o = p->n_op;
 969981         t = t1 = p->n_left->n_type;
<> 982+        q = q1 = p->n_left->n_qual;
970983         t2 = p->n_right->n_type;
<> 984+        q2 = p->n_right->n_qual;
971985         d = p->n_left->n_df;
 972986         d2 = p->n_right->n_df;
 973987         sue = p->n_left->n_sue;
     
 !
10031017 
 10041018                 if( !ISPTR(t1) ){
 10051019                         t = t2;
<> 1020+                        q = q2;
10061021                         d = d2;
 10071022                         sue = sue2;
 10081023                         break;
     
 !
10141029                 /* both are pointers */
 10151030                 if( talign(t2,sue2) < talign(t,sue) ){
 10161031                         t = t2;
<> 1032+                        q = q2;
10171033                         sue = sue2;
 10181034                         }
 10191035                 break;
 10201036                 }
 10211037 
<>1022 -        p->n_left = makety( p->n_left, t, d, sue );
 1023 -        p->n_right = makety( p->n_right, t, d, sue );
  1038+        p->n_left = makety( p->n_left, t, q, d, sue );
  1039+        p->n_right = makety( p->n_right, t, q, d, sue );
10241040         if( o!=MINUS && !clogop(o) ){
 10251041 
 10261042                 p->n_type = t;
<> 1043+                p->n_qual = q;
10271044                 p->n_df = d;
 10281045                 p->n_sue = sue;
 10291046                 }
     
 !
10961113            from LONG to INT and ULONG to UNSIGNED */
 10971114 
 10981115 
<>1099 -        if( t != t1 ) p->n_left = makety( p->n_left, tu, 0, MKSUE(tu));
  1116+        if( t != t1 ) p->n_left = makety( p->n_left, tu, 0, 0, MKSUE(tu));
11001117 
<>1101 -        if( t != t2 || o==CAST) p->n_right = makety( p->n_right, tu, 0, MKSUE(tu));
  1118+        if( t != t2 || o==CAST) p->n_right = makety( p->n_right, tu, 0, 0, MKSUE(tu));
11021119 
 11031120         if( casgop(o) ){
 11041121                 p->n_type = p->n_left->n_type;
     
 !
11191136         return(p);
 11201137         }
 11211138 
<> 1139+/*
  1140+ * make p into type t by inserting a conversion
  1141+ */
11221142 NODE *
<>1123 -makety(NODE *p, TWORD t, union dimfun *d, struct suedef *sue)
  1143+makety(NODE *p, TWORD t, TWORD q, union dimfun *d, struct suedef *sue)
11241144 {
<>1125 -        /* make p into type t by inserting a conversion */
11261145 
<>1127 -        if( p->n_type == ENUMTY && p->n_op == ICON ) econvert(p);
 1128 -        if( t == p->n_type ){
  1146+        if (p->n_type == ENUMTY && p->n_op == ICON)
  1147+                econvert(p);
  1148+        if (t == p->n_type) {
11291149                 p->n_df = d;
 11301150                 p->n_sue = sue;
<> 1151+                p->n_qual = q;
11311152                 return(p);
 11321153         }
 11331154 
<>1134 -        if( t & TMASK ){
  1155+        if (t & TMASK) {
11351156                 /* non-simple type */
<>1136 -                return( block( PCONV, p, NIL, t, d, sue));
 1137 -                }
  1157+                p = block(PCONV, p, NIL, t, d, sue);
  1158+                p->n_qual = q;
  1159+                return p;
  1160+        }
11381161 
<>1139 -        if( p->n_op == ICON ){
  1162+        if (p->n_op == ICON) {
11401163                 if (t == DOUBLE || t == FLOAT) {
 11411164                         p->n_op = FCON;
 11421165                         if (ISUNSIGNED(p->n_type))
 11431166                                 p->n_dcon = (U_CONSZ) p->n_lval;
 11441167                         else
 11451168                                 p->n_dcon = p->n_lval;
 11461169                         p->n_type = t;
<> 1170+                        p->n_qual = q;
11471171                         p->n_sue = MKSUE(t);
 11481172                         return (clocal(p));
 11491173                 }
 11501174         }
<>1151 -        return( clocal( block( SCONV, p, NIL, t, d, sue)));
  1175+        p = block(SCONV, p, NIL, t, d, sue);
  1176+        p->n_qual = q;
  1177+        return clocal(p);
<_11521178 
 11531179 }
 11541180 
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-22 23:06 +0100