Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.23
 
1.24
 
MAIN:ragge:20030121232624
 
pftn.c
_>187187                 if( scl==STATIC || scl==USTATIC ) return;
 188188                 break;
 189189 
<>190 -        case LABEL:
 191 -                if( scl == ULABEL ){
 192 -                        p->sclass = LABEL;
 193 -                        deflab( p->offset );
 194 -                        return;
 195 -                        }
 196 -                break;
 197 -
198190         case TYPEDEF:
 199191                 if( scl == class ) return;
 200192                 break;
     
 !
246238                 if( dimtab[p->sizoff] == 0 ) return/* previous entry just a mention */
 247239                 break;
 248240 
<>249 -        case ULABEL:
 250 -                if( scl == LABEL || scl == ULABEL ) return;
251241         case PARAM:
 252242         case AUTO:
 253243         case REGISTER:
     
 !
278268                 p = mknonuniq( &idp ); /* update p and idp to new entry */
 279269                 goto enter;
 280270                 }
<>281 -        if( blevel > slev && class != EXTERN && class != FORTRAN &&
 282 -                class != UFORTRAN && !( class == LABEL && slev >= 2 ) ){
  271+        if (blevel > slev && class != EXTERN && class != FORTRAN &&
  272+            class != UFORTRAN) {
283273                 q->tn.rval = idp = hide( p );
 284274                 p = &stab[idp];
 285275                 goto enter;
<>286 -                }
  276+        }
287277         uerror( "redeclaration of %s", p->sname );
 288278         if( class==EXTDEF && ISFTN(type) ) curftn = idp;
 289279         return;
     
 !
337327                 p->offset = getlab();
 338328                 if( ISFTN(type) ) curftn = idp;
 339329                 break;
<>340 -        case ULABEL:
 341 -        case LABEL:
 342 -                p->offset = getlab();
 343 -                p->slevel = 2;
 344 -                if( class == LABEL ){
 345 -                        (void) locctr( PROG );
 346 -                        deflab( p->offset );
 347 -                        }
 348 -                break;
349330 
 350331         case EXTERN:
 351332         case UFORTRAN:
     
 !
18991880                 else return( AUTO );
 19001881 
 19011882         case AUTO:
<>1902 -        case LABEL:
 1903 -        case ULABEL:
19041883                 if( blevel < 2 ) uerror( "illegal ULABEL class" );
 19051884                 return( class );
 19061885 
     
 !
19421921         return 0; /* XXX */
 19431922 }
 19441923 
<> 1924+#define MAXLABELS       100     /* per function */
  1925+static int labelno[MAXLABELS];
  1926+static char *labelname[MAXLABELS];
  1927+static int nlabels;
  1928+
  1929+static int
  1930+lentry(int id)
  1931+{
  1932+        int l;
  1933+
  1934+        /* Free symtab entry if unused */
  1935+        if (stab[id].stype == UNDEF)
  1936+                stab[id].stype = TNULL;
  1937+
  1938+        for (l = 0; l < nlabels; l++)
  1939+                if (labelname[l] == stab[id].sname)
  1940+                        break;
  1941+
  1942+        if (l == nlabels) {
  1943+                if (nlabels == MAXLABELS) {
  1944+                        uerror("too many labels");
  1945+                        nlabels = 0;
  1946+                        return 0;
  1947+                }
  1948+                labelno[nlabels] = -getlab();
  1949+                labelname[nlabels] = stab[id].sname;
  1950+                l = nlabels++;
  1951+        }
  1952+        return l;
  1953+}
  1954+
19451955 /*
<> 1956+ * Generates a goto statement; sets up label number etc.
  1957+ */
  1958+void
  1959+gotolabel(int id)
  1960+{
  1961+        int l = lentry(id);
  1962+        branch(labelno[l] < 0 ? -labelno[l] : labelno[l]);
  1963+}
  1964+
  1965+/*
  1966+ * Sets a label for gotos.
  1967+ */
  1968+void
  1969+deflabel(int id)
  1970+{
  1971+        int l = lentry(id);
  1972+
  1973+        if (labelno[l] > 0)
  1974+                uerror("label '%s' redefined", labelname[l]);
  1975+        labelno[l] = -labelno[l];
  1976+        locctr(PROG);
  1977+        deflab(labelno[l]);
  1978+}
  1979+
  1980+/*
19461981  * locate a symbol table entry for
 19471982  * an occurrence of a nonunique structure member name
 19481983  * or field
     
 !
20732108 clearst(int lev)
 20742109 {
 20752110         struct symtab *p, *q;
<>2076 -        int temp;
  2111+        int i, temp;
20772112         struct symtab *clist = 0;
 20782113 
 20792114         temp = lineno;
     
 !
20882123                         if( p->stype == TNULL || p->slevel <= lev )
 20892124                                 cerror( "schain botch" );
 20902125                         lineno = p->suse < 0 ? -p->suse : p->suse;
<>2091 -                        if( p->stype==UNDEF || ( p->sclass==ULABEL && lev<2 ) ){
  2126+                        if (p->stype==UNDEF) {
20922127                                 lineno = temp;
<>2093 -                                uerror( "%s undefined", p->sname );
 2094 -                                }
 2095 -                        else aocode(p);
  2128+                                uerror("%s undefined", p->sname);
  2129+                        } else
  2130+                                aocode(p);
20962131 # ifndef BUG1
 20972132                         if( ddebug ){
 20982133                                 printf( "removing %s", p->sname );
     
 !
21322167                         }
 21332168                 p = next;
 21342169                 }
<> 2170+        /* step 3: check for undefined labels and reset label stack */
  2171+        if (lev == 0) {
  2172+                for (i = 0; i < nlabels; i++)
  2173+                        if (labelno[i] < 0)
  2174+                                uerror("label '%s' not defined", labelname[i]);
  2175+                nlabels = 0;
  2176+        }
<_21352177 
 21362178         lineno = temp;
 21372179         aoend();
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-11 06:37 +0200