Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.47
 
1.48
 
MAIN:ragge:20030707131705
 
trees.c
_>149149                 case LE:
 150150                 case GE:
 151151                 case EQ:
<>152 -                case NE:        /* XXX 4.4 nedanstanende sats */
 153 -                        if( l->n_type == ENUMTY && r->n_type == ENUMTY ){
 154 -                                p = block(o, l, r, INT, 0, MKSUE(INT));
 155 -                                chkpun( p );
 156 -                                nfree(p);
 157 -                        }
 158 -
  152+                case NE:
159153                 case ANDAND:
 160154                 case OROR:
 161155                 case CBRANCH:
     
 !
12031197 # define MPTR 010       /* pointer */
 12041198 # define MPTI 020       /* pointer or integer */
 12051199 # define MENU 040       /* enumeration variable or member */
<>1206 -# define MVOID 0100000  /* void type */ /* XXX 4.4 */
12071200 
 12081201 int
 12091202 opact(NODE *p)  /* XXX 4.4 hela opact mixtrad med */
 12101203 {
 12111204         int mt12, mt1, mt2, o;
 12121205 
<>1213 -        mt1 = mt2 = mt12 = 0;
  1206+        mt12 = 0;
12141207 
 12151208         switch (optype(o = p->n_op)) {
 12161209         case BITYPE:
<>1217 -                mt2 = moditype(p->n_right->n_type);
  1210+                mt12=mt2 = moditype(p->n_right->n_type);
12181211         case UTYPE:
<>1219 -                mt1 = moditype(p->n_left->n_type);
  1212+                mt12 &= (mt1 = moditype(p->n_left->n_type));
12201213                 break;
 12211214         }
 12221215 
<>1223 -        if( ((mt1 | mt2) & MVOID) &&
 1224 -            o != COMOP &&
 1225 -            o != COLON &&
 1226 -            !(o == QUEST && (mt1 & MVOID) == 0) &&
 1227 -            !(o == CAST && (mt1 & MVOID)) ){
 1228 -                /* if lhs of RETURN is void, grammar will complain */
 1229 -                if (o != RETURN)
 1230 -                        uerror("value of void expression used");
 1231 -                return( NCVT );
 1232 -        }
 1233 -        mt12 = mt1 & mt2;
 1234 -
12351216         switch( o ){
 12361217 
 12371218         case NAME :
     
 !
12431224         case UNARY MUL:
 12441225                 {  return( OTHER ); }
 12451226         case UNARY MINUS:
<>1246 -                if( mt1 & MENU ) return( 0 );
12471227                 if( mt1 & MDBI ) return( TYPL );
 12481228                 break;
 12491229 
 12501230         case COMPL:
<>1251 -                if( mt1 & MENU ) return( 0 );
12521231                 if( mt1 & MINT ) return( TYPL );
 12531232                 break;
 12541233 
 12551234         case UNARY AND:
 12561235                 return( NCVT+OTHER );
 12571236         case INIT:
 12581237         case CM:
<>1259 -                return( 0 );
 1260 -
12611238         case NOT:
 12621239         case CBRANCH:
<>1263 -                if( mt1 & MSTR ) break;
 1264 -                return( 0 );
 1265 -
12661240         case ANDAND:
 12671241         case OROR:
<>1268 -                if( (mt1 & MSTR) || (mt2 & MSTR) ) break;
12691242                 return( 0 );
 12701243 
 12711244         case MUL:
 12721245         case DIV:
<> 1246+                if ((mt1&MDBI) && (mt2&MENU)) return( TYMATCH );
  1247+                if ((mt2&MDBI) && (mt1&MENU)) return( TYMATCH );
12731248                 if( mt12 & MDBI ) return( TYMATCH );
 12741249                 break;
 12751250 
     
 !
12821257 
 12831258         case LS:
 12841259         case RS:
<>1285 -                if( mt12 & MINT ) return( OTHER );
  1260+                if( mt12 & MINT ) return( TYPL+OTHER );
12861261                 break;
 12871262 
 12881263         case EQ:
     
 !
12911266         case LE:
 12921267         case GT:
 12931268         case GE:
<>1294 -                if( mt12 & MENU ) return( TYMATCH+NCVT+PUN );
 1295 -                if( mt12 & MDBI ) return( TYMATCH+NCVT+CVTO );
  1269+                if( (mt1&MENU)||(mt2&MENU) ) return( PTMATCH+PUN+NCVT );
  1270+                if( mt12 & MDBI ) return( TYMATCH+CVTO );
12961271                 else if( mt12 & MPTR ) return( PTMATCH+PUN );
 12971272                 else if( mt12 & MPTI ) return( PTMATCH+PUN );
 12981273                 else break;
     
 !
13091284                 return( TYPL );
 13101285 
 13111286         case COLON:
<>1312 -                if( mt12 & MENU ) return( NCVT+PUN+TYMATCH );
 1313 -                else if( mt12 & MDBI ) return( NCVT+TYMATCH );
  1287+                if( mt12 & MENU ) return( NCVT+PUN+PTMATCH );
  1288+                else if( mt12 & MDBI ) return( TYMATCH );
13141289                 else if( mt12 & MPTR ) return( TYPL+PTMATCH+PUN );
 13151290                 else if( (mt1&MINT) && (mt2&MPTR) ) return( TYPR+PUN );
 13161291                 else if( (mt1&MPTR) && (mt2&MINT) ) return( TYPL+PUN );
 13171292                 else if( mt12 & MSTR ) return( NCVT+TYPL+OTHER );
<>1318 -                else if( mt12 == MVOID ) return( NCVT+TYPL );
13191293                 break;
 13201294 
 13211295         case ASSIGN:
 13221296         case RETURN:
 13231297                 if( mt12 & MSTR ) return( LVAL+NCVT+TYPL+OTHER );
<>1324 -                else if( mt12 & MENU ) return( LVAL+NCVT+TYPL+TYMATCH+PUN );
13251298         case CAST:
<>1326 -                if(o==CAST && mt1==MVOID)return(TYPL+TYMATCH);
 1327 -                else if( mt12 & MDBI ) return( TYPL+LVAL+NCVT+TYMATCH );
 1328 -                else if( mt2 == MVOID &&
 1329 -                        ( p->n_right->n_op == CALL ||
 1330 -                          p->n_right->n_op == UNARY CALL)) break;
 1331 -                else if( (mt1 & MPTR) && (mt2 & MPTI) )
 1332 -                        return( LVAL+PTMATCH+PUN );
  1299+                if( mt12 & MDBI ) return( TYPL+LVAL+TYMATCH );
  1300+                else if( (mt1&MENU)||(mt2&MENU) )
  1301+                        return( LVAL+NCVT+TYPL+PTMATCH+PUN );
  1302+                else if( mt1 & MPTR) return( LVAL+PTMATCH+PUN );
13331303                 else if( mt12 & MPTI ) return( TYPL+LVAL+TYMATCH+PUN );
 13341304                 break;
 13351305 
     
 !
13701340         case PLUS:
 13711341                 if (mt12 & MDBI)
 13721342                         return(TYMATCH);
<>1373 -                else if ((mt1&MPTR) && (mt2&MINT))
  1343+                else if ((mt1&MPTR) && (mt2&MINT || mt2&MENU))
13741344                         return(TYPL+CVTR);
<>1375 -                else if ((mt1&MINT) && (mt2&MPTR))
  1345+                else if ((mt1&MINT || mt1&MENU) && (mt2&MPTR))
13761346                         return(TYPR+CVTL);
 13771347 
 13781348         }
<>1379 -        if (mt12 == MSTR)
 1380 -                uerror("%s is not a permitted struct/union operation", opst[o]);
 1381 -        else
 1382 -                uerror("operands of %s have incompatible types", opst[o]);
  1349+        uerror("operands of %s have incompatible types", opst[o]);
13831350         return(NCVT);
 13841351 }
 13851352 
     
 !
13881355 {
 13891356         switch (ty) {
 13901357 
<>1391 -        case UNDEF:
 1392 -                return( MVOID );
13931358         case ENUMTY:
 13941359         case MOETY:
<>1395 -                return( MENU|MINT|MDBI|MPTI );  /* enums are ints */
  1360+                return( MENU );
<_13961361 
 13971362         case STRTY:
 13981363         case UNIONTY:
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-10-02 16:30 +0200