Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.43
 
1.44
 
MAIN:ragge:20030706210146
 
trees.c
_>111111                         if( conval( l, o, l ) ) return(l);
 112112                         break;
 113113 
<>114 -                        }
115114                 }
<>116 -
 117 -        /* XXX 4.4  följande sats */
 118 -        else if( opty == UTYPE && (l->n_op == FCON || l->n_op == DCON) ){
 119 -
 120 -                switch( o ){
 121 -
 122 -                case NOT:
 123 -                        if( l->n_op == FCON )
 124 -                                l->n_lval = l->n_fcon == 0.0;
 125 -                        else
 126 -                                l->n_lval = l->n_dcon == 0.0;
 127 -                        l->n_sp = NULL;
 128 -                        l->n_op = ICON;
 129 -                        l->n_type = INT;
 130 -                        l->n_sue = MKSUE(INT);
 131 -                        l->n_df = NULL;
 132 -                        return(l);
 133 -                case UNARY MINUS:
 134 -                        if( l->n_op == FCON )
  115+        } else if( o == UNARY MINUS && l->n_op == FCON ){
  116+                        if( l->n_type == FLOAT )
135117                                 l->n_fcon = -l->n_fcon;
 136118                         else
 137119                                 l->n_dcon = -l->n_dcon;
 138120                         return(l);
<>139 -                        }
 140 -                }
141121 
<>142 -        else if( o==QUEST && l->n_op==ICON ) {
  122+        } else if( o==QUEST && l->n_op==ICON ) {
143123                 CONSZ c = l->n_lval;
 144124                 nfree(l);
 145125                 if (c) {
     
 !
153133                         nfree(r);
 154134                         return(l);
 155135                 }
<>156 -        }
  136+        } else if( (o==ANDAND || o==OROR) && (l->n_op==ICON||r->n_op==ICON) )
  137+                goto ccwarn;
157138 
<>158 -        else if( (o==ANDAND || o==OROR) && (l->n_op==ICON||r->n_op==ICON) ) goto ccwarn;
 159 -
160139         else if( opty == BITYPE && l->n_op == ICON && r->n_op == ICON ){
 161140 
 162141                 switch( o ){
     
 !
196175                         if( conval( l, o, r ) ) {
 197176                                 nfree(r);
 198177                                 return(l);
<>199 -                                }
 200 -                        break;
201178                         }
<> 179+                        break;
202180                 }
<>203 -        else if (opty == BITYPE &&      /* XXX 4.4 DCON-tillägget */
 204 -                (l->n_op == FCON || l->n_op == DCON || l->n_op == ICON) &&
 205 -                (r->n_op == FCON || r->n_op == DCON || r->n_op == ICON)) {
 206 -                        if (o == PLUS || o == MINUS || o == MUL || o == DIV) {
 207 -                                extern int fpe_count;
 208 -                                extern jmp_buf gotfpe;
 209 -
 210 -                                fpe_count = 0;
 211 -                                if (setjmp(gotfpe))
 212 -                                        goto treatfpe;
 213 -                                if (l->n_op == ICON)
 214 -                                        l->n_dcon = l->n_lval;
 215 -                                else if (l->n_op == FCON)
 216 -                                        l->n_dcon = l->n_fcon;
 217 -                                if (r->n_op == ICON)
 218 -                                        r->n_dcon = r->n_lval;
 219 -                                else if (r->n_op == FCON)
 220 -                                        r->n_dcon = r->n_fcon;
 221 -                                switch (o) {
 222 -
 223 -                                case PLUS:
 224 -                                        l->n_dcon += r->n_dcon;
 225 -                                        break;
 226 -
 227 -                                case MINUS:
 228 -                                        l->n_dcon -= r->n_dcon;
 229 -                                        break;
 230 -
 231 -                                case MUL:
 232 -                                        l->n_dcon *= r->n_dcon;
 233 -                                        break;
 234 -
 235 -                                case DIV:
 236 -                                        if (r->n_dcon == 0)
 237 -                                                uerror("division by 0.");
 238 -                                        else
 239 -                                                l->n_dcon /= r->n_dcon;
 240 -                                        break;
 241 -                                        }
 242 -                        treatfpe:
 243 -                                if (fpe_count > 0) {
 244 -                                        uerror("floating point exception in constant expression");
 245 -                                        l->n_dcon = 1.0; /* Fairly harmless */
 246 -                                        }
 247 -                                fpe_count = -1;
 248 -                                l->n_op = DCON;
 249 -                                l->n_type = DOUBLE;
 250 -                                l->n_sue = MKSUE(DOUBLE);
 251 -                                nfree(r);
 252 -                                return (l);
  181+        } else if (opty == BITYPE && (l->n_op == FCON || l->n_op == ICON) &&
  182+            (r->n_op == FCON || r->n_op == ICON) && (o == PLUS || o == MINUS ||
  183+            o == MUL || o == DIV)) {
  184+                switch(o){
  185+                case PLUS:
  186+                case MINUS:
  187+                case MUL:
  188+                case DIV:
  189+                        if (l->n_op == ICON)
  190+                                l->n_dcon = l->n_lval;
  191+                        else if (l->n_type == FLOAT)
  192+                                l->n_dcon = l->n_fcon;
  193+                        if (r->n_op == ICON)
  194+                                r->n_dcon = r->n_lval;
  195+                        else if (r->n_type == FLOAT)
  196+                                r->n_dcon = r->n_fcon;
  197+                        switch (o) {
  198+                        case PLUS:
  199+                                l->n_dcon += r->n_dcon; break;
  200+                        case MINUS:
  201+                                l->n_dcon -= r->n_dcon; break;
  202+                        case MUL:
  203+                                l->n_dcon *= r->n_dcon; break;
  204+                        case DIV:
  205+                                if (r->n_dcon == 0)
  206+                                        uerror("division by 0.");
  207+                                else
  208+                                        l->n_dcon /= r->n_dcon;
253209                         }
<> 210+                        l->n_op = FCON;
  211+                        l->n_type = DOUBLE;
  212+                        l->n_sue = MKSUE(DOUBLE);
  213+                        nfree(r);
  214+                        return(l);
254215                 }
<> 216+        }
255217 
 256218         /* its real; we must make a new node */
 257219 
     
 !
334296                         }
 335297                         break;
 336298 
<>337 -                case ICON:
 338 -                        p->n_type = INT;
 339 -                        p->n_df = NULL;
 340 -                        p->n_sue = MKSUE(INT);
 341 -                        break;
 342 -
343299                 case STRING:
 344300                         p->n_op = NAME;
 345301 #ifdef CHAR_UNSIGNED
     
 !
353309                         p->n_sp = NULL;
 354310                         break;
 355311 
<>356 -                case FCON:
 357 -                        p->n_lval = 0;
 358 -                        p->n_rval = 0;
 359 -                        p->n_type = FLOAT;
 360 -                        p->n_df = NULL;
 361 -                        p->n_sue = MKSUE(FLOAT);
 362 -                        break;
 363 -
 364 -                case DCON:      /* XXX 4.4 */
 365 -                        p->n_lval = 0;
 366 -                        p->n_rval = 0;
 367 -                        p->n_type = DOUBLE;
 368 -                        p->n_df = NULL;
 369 -                        p->n_sue = MKSUE(DOUBLE);
 370 -                        break;
 371 -
372312                 case STREF:
 373313                         /* p->x turned into *(p+offset) */
 374314                         /* rhs must be a name; check correctness */
     
 !
564504 
 565505         }
 566506 
<>567 -int fpe_count = -1;
 568 -jmp_buf gotfpe;
 569 -
 570 -void fpe(int);
 571 -void
 572 -fpe(int a)      /* XXX 4.4 */
 573 -{
 574 -        if (fpe_count < 0)
 575 -                cerror("floating point exception");
 576 -        ++fpe_count;
 577 -        longjmp(gotfpe, 1);
 578 -}
 579 -
580507 /*      * XXX 4.4 comments *
 581508  * Rewrite arguments in a function call.
 582509  * Structure arguments are massaged, single
     
 !
12281155                 }
 12291156 
 12301157         if( p->n_op == ICON ){
<>1231 -                if (t == DOUBLE) {      /* XXX 4.4 */
 1232 -                        p->n_op = DCON;
  1158+                if (t == DOUBLE || t == FLOAT) {
  1159+                        p->n_op = FCON;
12331160                         if (ISUNSIGNED(p->n_type))
 12341161                                 p->n_dcon = (U_CONSZ) p->n_lval;
 12351162                         else
     
 !
12381165                         p->n_sue = MKSUE(t);
 12391166                         return (clocal(p));
 12401167                 }
<>1241 -                if (t == FLOAT) {       /* XXX 4.4 */
 1242 -                        p->n_op = FCON;
 1243 -                        if( ISUNSIGNED(p->n_type) ){
 1244 -                                p->n_fcon = (U_CONSZ) p->n_lval;
 1245 -                                }
 1246 -                        else {
 1247 -                                p->n_fcon = p->n_lval;
 1248 -                                }
 1249 -
 1250 -                        p->n_type = t;
 1251 -                        p->n_sue = MKSUE(t);
 1252 -                        return( clocal(p) );
 1253 -                        }
 1254 -                }
 1255 -        else if (p->n_op == FCON && t == DOUBLE) {      /* XXX 4.4 */
 1256 -                double db;
 1257 -
 1258 -                p->n_op = DCON/* XXX 4.4 */
 1259 -                db = p->n_fcon/* XXX 4.4 */
 1260 -                p->n_dcon = db/* XXX 4.4 */
 1261 -                p->n_type = t;  /* XXX 4.4 */
 1262 -                p->n_sue = MKSUE(t);    /* XXX 4.4 */
 1263 -                return (clocal(p));     /* XXX 4.4 */
 1264 -        } else if (p->n_op == DCON && t == FLOAT) {     /* XXX 4.4 */
 1265 -                float fl;       /* XXX 4.4 */
 1266 -        /* XXX 4.4 */
 1267 -                p->n_op = FCON/* XXX 4.4 */
 1268 -                fl = p->n_dcon/* XXX 4.4 */
 1269 -#ifdef notdef
 1270 -                if (fl != p->n_dcon)
 1271 -                        werror("float conversion loses precision");
 1272 -#endif
 1273 -                p->n_fcon = fl;
 1274 -                p->n_type = t;
 1275 -                p->n_sue = MKSUE(t);
 1276 -                return (clocal(p));
12771168         }
<> 1169+        return( clocal( block( SCONV, p, NIL, t, d, sue)));
12781170 
<>1279 -        return( clocal( block( SCONV, p, NIL, t, d, sue)));     /* XXX 4.4 */
  1171+}
12801172 
<>1281 -        }
 1282 -
12831173 NODE *
 12841174 block(int o, NODE *l, NODE *r, TWORD t, union dimfun *d, struct suedef *sue)
 12851175 {
     
 !
13831273         case STRING :
 13841274         case ICON :
 13851275         case FCON :
<>1386 -        case DCON :
<_13871276         case CALL :
 13881277         case UNARY CALL:
 13891278         case UNARY MUL:
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-07-10 21:31 +0200