Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.264
 
1.265
 
MAIN:ragge:20090611165647
 
pftn.c
_>123123 
 124124 void fixtype(NODE *p, int class);
 125125 int fixclass(int class, TWORD type);
<>126 -int falloc(struct symtab *p, int w, int new, NODE *pty);
127126 static void dynalloc(struct symtab *p, int *poff);
 128127 void inforce(OFFSZ n);
 129128 void vfdalign(int n);
     
 !
404403 
 405404         /* allocate offsets */
 406405         if (class&FIELD) {
<>407 -                (void) falloc(p, class&FLDSIZ, 0, NIL);  /* new entry */
  406+                (void) falloc(p, class&FLDSIZ, NIL);  /* new entry */
408407         } else switch (class) {
 409408 
 410409         case REGISTER:
     
 !
13881387  * new is 0 if new entry, 1 if redefinition, -1 if alignment
 13891388  */
 13901389 int
<>1391 -falloc(struct symtab *p, int w, int new, NODE *pty)
  1390+falloc(struct symtab *p, int w, NODE *pty)
13921391 {
 13931392         int al,sz,type;
 13941393 
<>1395 -        type = (new<0)? pty->n_type : p->stype;
  1394+        type = p ? p->stype : pty->n_type;
13961395 
<>1397 -        /* this must be fixed to use the current type in alignments */
 1398 -        switch( new<0?pty->n_type:p->stype ){
  1396+        if (type < CHAR || type > ULONGLONG) {
  1397+                uerror("illegal field type");
  1398+                type = INT;
  1399+        }
13991400 
<>1400 -        case CHAR:
 1401 -        case UCHAR:
 1402 -                al = ALCHAR;
 1403 -                sz = SZCHAR;
 1404 -                break;
  1401+        al = btdims[type].suealign;
  1402+        sz = btdims[type].suesize;
14051403 
<>1406 -        case SHORT:
 1407 -        case USHORT:
 1408 -                al = ALSHORT;
 1409 -                sz = SZSHORT;
 1410 -                break;
 1411 -
 1412 -        case INT:
 1413 -        case UNSIGNED:
 1414 -                al = ALINT;
 1415 -                sz = SZINT;
 1416 -                break;
 1417 -
 1418 -        default:
 1419 -                if( new < 0 ) {
 1420 -                        uerror( "illegal field type" );
 1421 -                        al = ALINT;
 1422 -                } else
 1423 -                        al = fldal( p->stype );
 1424 -                sz =SZINT;
  1404+        if (w > sz) {
  1405+                uerror("field too big");
  1406+                w = sz;
14251407         }
 14261408 
<>1427 -        if( w > sz ) {
 1428 -                uerror( "field too big");
 1429 -                w = sz;
 1430 -                }
 1431 -
 1432 -        if( w == 0 ){ /* align only */
 1433 -                SETOFF( rpole->rstr, al );
 1434 -                if( new >= 0 ) uerror( "zero size field");
  1409+        if (w == 0) { /* align only */
  1410+                SETOFF(rpole->rstr, al);
  1411+                if (p != NULL)
  1412+                        uerror("zero size field");
14351413                 return(0);
<>1436 -                }
  1414+        }
14371415 
<>1438 -        if( rpole->rstr%al + w > sz ) SETOFF( rpole->rstr, al );
 1439 -        if( new < 0 ) {
  1416+        if (rpole->rstr%al + w > sz)
  1417+                SETOFF(rpole->rstr, al);
  1418+        if (p == NULL) {
14401419                 rpole->rstr += w/* we know it will fit */
 14411420                 return(0);
<>1442 -                }
  1421+        }
14431422 
 14441423         /* establish the field */
 14451424 
<>1446 -        if( new == 1 ) { /* previous definition */
 1447 -                if( p->soffset != rpole->rstr || p->sclass != (FIELD|w) ) return(1);
 1448 -                }
14491425         p->soffset = rpole->rstr;
 14501426         rpole->rstr += w;
 14511427         p->stype = type;
<>1452 -        fldty( p );
  1428+        fldty(p);
<_14531429         return(0);
 14541430 }
 14551431 
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-26 13:53 +0100