Subject: 'void *' causes lint to die with 'schain botch' error (#218) Index: lib/mip/{*.c,*.h} usr.bin/lint/{Makefile,lint.c} 2.11BSD Description: The generic pointer construct "void *" causes 'lint' to fail with a "schain botch" error. Repeat-By: Run the following command on a file containing the following lines: /lib/cpp -C -Dlint filename | /usr/lib/lint/lint1 -v > /tmp/junk.ln ------snip---- #include /* LINTLIBRARY */ int sysctl(m,n,b,l,nv,ns) u_int m[]; u_int n; void *b; size_t *l, ns; void *nv; ------snip---- Note the 'schain botch' error which occurs. Fix: The fix is much larger than originally anticipated. Initially the problem was thought to be caused by a memory shortage (lint1 is large and is always on the verge of running out of memory). Moving error message strings to a file using the 'mkstr' program has been used in the past with other programs (sendmail, f77, pascal compiler). This was done to 'lint'. 'mkstr' insists that the double quote ('"') beginning the string be _immediately_ adjacent to the opening parenthese '('. Thus 'mkstr' will extract the string from: werror("this is an error"); but not from: werror( "this is an error"); Someone (years ago) had the bright idea to put spaces after all the error calls (werror, cerror and uerror routines) - naturally 'mkstr' could not find very many strings to extract. The bulk of this update is to remove the superfluous spaces so that error strings can be extracted by 'mkstr'. The actual fix for the "void *" problem is a 1 line change in manifest.h and removal of 2 lines in trees.c. Extracting error strings was a big success. Almost 6kb of data space was freed! This was enough room that the symbol table and dimension table could be increased and still have some extra memory available for symbol name strings. "void *" now is processed by 'lint' without errors and it is once again possible to run 'lint' against the kernel sources. Hurrah! It is still _not_ possible to run 'lint' over the 'tcsh' sources. That program is declaration crazy and causes lint to exhaust the symbol table. The Makefile for 'lint' has changed considerably. The use of 'mkstr' made these changes necessary. To apply this update: 1) save the patch below to a file (/tmp/foo) 2) patch -p0 < /tmp/foo 3) then: cd /usr/src/usr.bin/lint make make install make clean Previous patches are available via anonymous FTP to the host 'ftp.iipo.gtegsc.com' in the directory /pub/2.11BSD. ==================cut here============ *** /usr/src/lib/mip/allo.c.old Sat Aug 17 13:33:22 1991 --- /usr/src/lib/mip/allo.c Tue Jan 17 23:57:18 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)allo.c 4.8 (Berkeley) 1/8/86"; #endif lint # include "pass2.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)allo.c 4.8.1 (2.11BSD GTE) 1/17/95"; #endif lint # include "pass2.h" *************** *** 135,141 **** tmpoff += k*SZINT; if( tmpoff > maxoff ) maxoff = tmpoff; if( tmpoff >= offsz ) ! cerror( "stack overflow" ); if( tmpoff-baseoff > maxtemp ) maxtemp = tmpoff-baseoff; return(t); --- 135,141 ---- tmpoff += k*SZINT; if( tmpoff > maxoff ) maxoff = tmpoff; if( tmpoff >= offsz ) ! cerror("stack overflow" ); if( tmpoff-baseoff > maxtemp ) maxtemp = tmpoff-baseoff; return(t); *************** *** 146,152 **** } if( tmpoff > maxoff ) maxoff = tmpoff; if( tmpoff >= offsz ) ! cerror( "stack overflow" ); if( tmpoff-baseoff > maxtemp ) maxtemp = tmpoff-baseoff; return( -tmpoff ); # endif --- 146,152 ---- } if( tmpoff > maxoff ) maxoff = tmpoff; if( tmpoff >= offsz ) ! cerror("stack overflow" ); if( tmpoff-baseoff > maxtemp ) maxtemp = tmpoff-baseoff; return( -tmpoff ); # endif *************** *** 191,197 **** /* decide if register r is usable in tree p to satisfy need n */ /* checks, for the moment */ ! if( !istreg(r) ) cerror( "usable asked about nontemp register" ); if( busy[r] > 1 ) return(0); if( isbreg(r) ){ --- 191,197 ---- /* decide if register r is usable in tree p to satisfy need n */ /* checks, for the moment */ ! if( !istreg(r) ) cerror("usable asked about nontemp register" ); if( busy[r] > 1 ) return(0); if( isbreg(r) ){ *************** *** 308,321 **** # endif if( istreg(r) ){ ! if( --busy[r] < 0 ) cerror( "register overfreed"); if( szty(t) == 2 ){ #ifdef NOEVENODD ! if( istreg(r) ^ istreg(r+1) ) cerror( "illegal free" ); #else ! if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror( "illegal free" ); #endif ! if( --busy[r+1] < 0 ) cerror( "register overfreed" ); } } } --- 308,321 ---- # endif if( istreg(r) ){ ! if( --busy[r] < 0 ) cerror("register overfreed"); if( szty(t) == 2 ){ #ifdef NOEVENODD ! if( istreg(r) ^ istreg(r+1) ) cerror("illegal free" ); #else ! if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror("illegal free" ); #endif ! if( --busy[r+1] < 0 ) cerror("register overfreed" ); } } } *************** *** 336,344 **** if( szty(t) == 2 ){ if( istreg(r+1) ) ++busy[r+1]; #ifdef NOEVENODD ! if( istreg(r) ^ istreg(r+1) ) cerror( "illegal register pair freed" ); #else ! if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror( "illegal register pair freed" ); #endif } } --- 336,344 ---- if( szty(t) == 2 ){ if( istreg(r+1) ) ++busy[r+1]; #ifdef NOEVENODD ! if( istreg(r) ^ istreg(r+1) ) cerror("illegal register pair freed" ); #else ! if( (r&01) || (istreg(r)^istreg(r+1)) ) cerror("illegal register pair freed" ); #endif } } *************** *** 433,439 **** if( rw&RESC3 ) *qq++ = &resc[2]; if( qq == recres ){ ! cerror( "illegal reclaim"); } *qq = NIL; --- 433,439 ---- if( rw&RESC3 ) *qq++ = &resc[2]; if( qq == recres ){ ! cerror("illegal reclaim"); } *qq = NIL; *************** *** 449,455 **** } /* we can't do it; die */ ! cerror( "cannot reclaim"); gotit: --- 449,455 ---- } /* we can't do it; die */ ! cerror("cannot reclaim"); gotit: *************** *** 496,502 **** if( i & NOPREF ) return; if( i != p->tn.rval ){ if( busy[i] || ( szty(p->in.type)==2 && busy[i+1] ) ){ ! cerror( "faulty register move" ); } rbusy( i, p->in.type ); rfree( p->tn.rval, p->in.type ); --- 496,502 ---- if( i & NOPREF ) return; if( i != p->tn.rval ){ if( busy[i] || ( szty(p->in.type)==2 && busy[i+1] ) ){ ! cerror("faulty register move" ); } rbusy( i, p->in.type ); rfree( p->tn.rval, p->in.type ); *************** *** 506,517 **** case OREG: if( p->in.op == REG || !R2TEST(p->tn.rval) ) { ! if( busy[p->tn.rval]>1 && istreg(p->tn.rval) ) cerror( "potential register overwrite"); } else if( (R2UPK1(p->tn.rval) != 100 && busy[R2UPK1(p->tn.rval)]>1 && istreg(R2UPK1(p->tn.rval)) ) || (busy[R2UPK2(p->tn.rval)]>1 && istreg(R2UPK2(p->tn.rval)) ) ) ! cerror( "potential register overwrite"); } } --- 506,517 ---- case OREG: if( p->in.op == REG || !R2TEST(p->tn.rval) ) { ! if( busy[p->tn.rval]>1 && istreg(p->tn.rval) ) cerror("potential register overwrite"); } else if( (R2UPK1(p->tn.rval) != 100 && busy[R2UPK1(p->tn.rval)]>1 && istreg(R2UPK1(p->tn.rval)) ) || (busy[R2UPK2(p->tn.rval)]>1 && istreg(R2UPK2(p->tn.rval)) ) ) ! cerror("potential register overwrite"); } } *************** *** 581,587 **** REGLOOP(i){ if( istreg(i) && busy[i] ){ ! cerror( "register allocation error"); } } --- 581,587 ---- REGLOOP(i){ if( istreg(i) && busy[i] ){ ! cerror("register allocation error"); } } *** /usr/src/lib/mip/cgram.y.old Sat Aug 17 13:38:53 1991 --- /usr/src/lib/mip/cgram.y Tue Jan 17 23:58:18 1995 *************** *** 1,4 **** ! /* cgram.y 4.4 85/08/22 */ /* * Grammar for the C compiler. --- 1,4 ---- ! /* cgram.y 4.4.1 95/01/17 */ /* * Grammar for the C compiler. *************** *** 80,86 **** #endif } function_body ={ ! if( blevel ) cerror( "function level error" ); if( reached ) retstat |= NRETVAL; $1->in.op = FREE; ftnend(); --- 80,86 ---- #endif } function_body ={ ! if( blevel ) cerror("function level error" ); if( reached ) retstat |= NRETVAL; $1->in.op = FREE; ftnend(); *************** *** 231,239 **** | nfdeclarator | nfdeclarator COLON con_e %prec CM ! ={ if( !(instruct&INSTRUCT) ) uerror( "field outside of structure" ); if( $3<0 || $3 >= FIELD ){ ! uerror( "illegal field size" ); $3 = 1; } defid( tymerge($0,$1), FIELD|$3 ); --- 231,239 ---- | nfdeclarator | nfdeclarator COLON con_e %prec CM ! ={ if( !(instruct&INSTRUCT) ) uerror("field outside of structure" ); if( $3<0 || $3 >= FIELD ){ ! uerror("illegal field size" ); $3 = 1; } defid( tymerge($0,$1), FIELD|$3 ); *************** *** 241,247 **** } | COLON con_e %prec CM ! ={ if( !(instruct&INSTRUCT) ) uerror( "field outside of structure" ); falloc( stab, $2, -1, $0 ); /* alignment or hole */ $$ = NIL; } --- 241,247 ---- } | COLON con_e %prec CM ! ={ if( !(instruct&INSTRUCT) ) uerror("field outside of structure" ); falloc( stab, $2, -1, $0 ); /* alignment or hole */ $$ = NIL; } *************** *** 261,267 **** $$ = bdty( LB, $1, 0 ); } | nfdeclarator LB con_e RB ={ bary: ! if( (int)$3 <= 0 ) werror( "zero or negative subscript" ); $$ = bdty( LB, $1, $3 ); } | NAME ={ $$ = bdty( NAME, NIL, $1 ); } --- 261,267 ---- $$ = bdty( LB, $1, 0 ); } | nfdeclarator LB con_e RB ={ bary: ! if( (int)$3 <= 0 ) werror("zero or negative subscript" ); $$ = bdty( LB, $1, $3 ); } | NAME ={ $$ = bdty( NAME, NIL, $1 ); } *************** *** 324,330 **** | fdeclarator ={ defid( tymerge($0,$1), uclass(curclass) ); if( paramno > 0 ){ ! uerror( "illegal argument" ); paramno = 0; } } --- 324,330 ---- | fdeclarator ={ defid( tymerge($0,$1), uclass(curclass) ); if( paramno > 0 ){ ! uerror("illegal argument" ); paramno = 0; } } *************** *** 357,363 **** ; optasgn : /* VOID */ ! ={ werror( "old-fashioned initialization: use =" ); } | ASSIGN ; --- 357,363 ---- ; optasgn : /* VOID */ ! ={ werror("old-fashioned initialization: use =" ); } | ASSIGN ; *************** *** 398,404 **** begin: LC ={ if( blevel == 1 ) dclargs(); ++blevel; ! if( psavbc > &asavbc[BCSZ-2] ) cerror( "nesting too deep" ); *psavbc++ = regvar; *psavbc++ = autooff; } --- 398,404 ---- begin: LC ={ if( blevel == 1 ) dclargs(); ++blevel; ! if( psavbc > &asavbc[BCSZ-2] ) cerror("nesting too deep" ); *psavbc++ = regvar; *psavbc++ = autooff; } *************** *** 451,457 **** resetbc(FCONT); } | BREAK SM ! ={ if( brklab == NOLAB ) uerror( "illegal break"); else if(reached) branch( brklab ); flostat |= FBRK; if( brkflag ) goto rch; --- 451,457 ---- resetbc(FCONT); } | BREAK SM ! ={ if( brklab == NOLAB ) uerror("illegal break"); else if(reached) branch( brklab ); flostat |= FBRK; if( brkflag ) goto rch; *************** *** 458,464 **** reached = 0; } | CONTINUE SM ! ={ if( contlab == NOLAB ) uerror( "illegal continue"); else branch( contlab ); flostat |= FCONT; goto rch; --- 458,464 ---- reached = 0; } | CONTINUE SM ! ={ if( contlab == NOLAB ) uerror("illegal continue"); else branch( contlab ); flostat |= FCONT; goto rch; *************** *** 467,473 **** ={ retstat |= NRETVAL; branch( retlab ); rch: ! if( !reached ) werror( "statement not reached"); reached = 0; } | RETURN e SM --- 467,473 ---- ={ retstat |= NRETVAL; branch( retlab ); rch: ! if( !reached ) werror("statement not reached"); reached = 0; } | RETURN e SM *************** *** 520,526 **** ; doprefix: DO ={ savebc(); ! if( !reached ) werror( "loop not entered at top"); brklab = getlab(); contlab = getlab(); deflab( $$ = getlab() ); --- 520,526 ---- ; doprefix: DO ={ savebc(); ! if( !reached ) werror("loop not entered at top"); brklab = getlab(); contlab = getlab(); deflab( $$ = getlab() ); *************** *** 542,548 **** whprefix: WHILE LP e RP ={ savebc(); ! if( !reached ) werror( "loop not entered at top"); if( $3->in.op == ICON && $3->tn.lval != 0 ) flostat = FLOOP; deflab( contlab = getlab() ); reached = 1; --- 542,548 ---- whprefix: WHILE LP e RP ={ savebc(); ! if( !reached ) werror("loop not entered at top"); if( $3->in.op == ICON && $3->tn.lval != 0 ) flostat = FLOOP; deflab( contlab = getlab() ); reached = 1; *************** *** 553,559 **** ; forprefix: FOR LP .e SM .e SM ={ if( $3 ) ecomp( $3 ); ! else if( !reached ) werror( "loop not entered at top"); savebc(); contlab = getlab(); brklab = getlab(); --- 553,559 ---- ; forprefix: FOR LP .e SM .e SM ={ if( $3 ) ecomp( $3 ); ! else if( !reached ) werror("loop not entered at top"); savebc(); contlab = getlab(); brklab = getlab(); *************** *** 605,611 **** preconf: if( yychar==RELOP||yychar==EQUOP||yychar==AND||yychar==OR||yychar==ER ){ precplaint: ! if( hflag ) werror( "precedence confusion possible: parenthesize!" ); } bop: $$ = buildtree( $2, $1, $3 ); --- 605,611 ---- preconf: if( yychar==RELOP||yychar==EQUOP||yychar==AND||yychar==OR||yychar==ER ){ precplaint: ! if( hflag ) werror("precedence confusion possible: parenthesize!" ); } bop: $$ = buildtree( $2, $1, $3 ); *************** *** 658,664 **** ={ $$=buildtree(QUEST, $1, buildtree( COLON, $3, $5 ) ); } | e ASOP e ! ={ werror( "old-fashioned assignment operator" ); goto bop; } | e ASSIGN e ={ goto bop; } | term --- 658,664 ---- ={ $$=buildtree(QUEST, $1, buildtree( COLON, $3, $5 ) ); } | e ASOP e ! ={ werror("old-fashioned assignment operator" ); goto bop; } | e ASSIGN e ={ goto bop; } | term *************** *** 671,677 **** } | AND term ={ if( ISFTN($2->in.type) || ISARY($2->in.type) ){ ! werror( "& before array or function: ignored" ); $$ = $2; } else goto ubop; --- 671,677 ---- } | AND term ={ if( ISFTN($2->in.type) || ISARY($2->in.type) ){ ! werror("& before array or function: ignored" ); $$ = $2; } else goto ubop; *************** *** 717,725 **** if( blevel==0 && stab[idname].stype == UNDEF ) { register NODE *q; #ifndef FLEXNAMES ! werror( "undeclared initializer name %.8s", stab[idname].sname ); #else ! werror( "undeclared initializer name %s", stab[idname].sname ); #endif q = block( FREE, NIL, NIL, INT, 0, INT ); q->tn.rval = idname; --- 717,725 ---- if( blevel==0 && stab[idname].stype == UNDEF ) { register NODE *q; #ifndef FLEXNAMES ! werror("undeclared initializer name %.8s", stab[idname].sname ); #else ! werror("undeclared initializer name %s", stab[idname].sname ); #endif q = block( FREE, NIL, NIL, INT, 0, INT ); q->tn.rval = idname; *************** *** 813,819 **** break; default: ! cerror( "bad bdty" ); } return( q ); --- 813,819 ---- break; default: ! cerror("bad bdty" ); } return( q ); *************** *** 821,827 **** dstash( n ) OFFSZ n;{ /* put n into the dimension table */ if( curdim >= DIMTABSZ-1 ){ ! cerror( "dimension table overflow"); } dimtab[ curdim++ ] = n; } --- 821,827 ---- dstash( n ) OFFSZ n;{ /* put n into the dimension table */ if( curdim >= DIMTABSZ-1 ){ ! cerror("dimension table overflow"); } dimtab[ curdim++ ] = n; } *************** *** 828,834 **** savebc() { if( psavbc > & asavbc[BCSZ-4 ] ){ ! cerror( "whiles, fors, etc. too deeply nested"); } *psavbc++ = brklab; *psavbc++ = contlab; --- 828,834 ---- savebc() { if( psavbc > & asavbc[BCSZ-4 ] ){ ! cerror("whiles, fors, etc. too deeply nested"); } *psavbc++ = brklab; *psavbc++ = contlab; *************** *** 850,864 **** p = optim( p ); /* change enum to ints */ if( p->in.op != ICON ){ ! uerror( "non-constant case expression"); return; } if( swp == swtab ){ ! uerror( "case not in switch"); return; } if( swp >= &swtab[SWITSZ] ){ ! cerror( "switch table overflow"); } swp->sval = p->tn.lval; deflab( swp->slab = getlab() ); --- 850,864 ---- p = optim( p ); /* change enum to ints */ if( p->in.op != ICON ){ ! uerror("non-constant case expression"); return; } if( swp == swtab ){ ! uerror("case not in switch"); return; } if( swp >= &swtab[SWITSZ] ){ ! cerror("switch table overflow"); } swp->sval = p->tn.lval; deflab( swp->slab = getlab() ); *************** *** 868,878 **** adddef(){ /* add default case to switch */ if( swtab[swx].slab >= 0 ){ ! uerror( "duplicate default in switch"); return; } if( swp == swtab ){ ! uerror( "default not inside switch"); return; } deflab( swtab[swx].slab = getlab() ); --- 868,878 ---- adddef(){ /* add default case to switch */ if( swtab[swx].slab >= 0 ){ ! uerror("duplicate default in switch"); return; } if( swp == swtab ){ ! uerror("default not inside switch"); return; } deflab( swtab[swx].slab = getlab() ); *************** *** 881,887 **** swstart(){ /* begin a switch block */ if( swp >= &swtab[SWITSZ] ){ ! cerror( "switch table overflow"); } swx = swp - swtab; swp->slab = -1; --- 881,887 ---- swstart(){ /* begin a switch block */ if( swp >= &swtab[SWITSZ] ){ ! cerror("switch table overflow"); } swx = swp - swtab; swp->slab = -1; *************** *** 923,929 **** for( p = swbeg+1; psval == (p-1)->sval ){ ! uerror( "duplicate case in switch, %d", tempi=p->sval ); return; } } --- 923,929 ---- for( p = swbeg+1; psval == (p-1)->sval ){ ! uerror("duplicate case in switch, %d", tempi=p->sval ); return; } } *** /usr/src/lib/mip/common.c.old Sat Aug 3 12:07:11 1991 --- /usr/src/lib/mip/common.c Tue Jan 17 23:59:07 1995 *************** *** 1,5 **** ! /* common.c 4.2 85/08/22 */ #ifdef PASS1COMMON #include "pass1.h" #else --- 1,7 ---- ! /* common.c 4.2.1 95/01/17 */ + static char *StringFile = STRINGFILE; /* From Makefile -DSTRINGFILE= ... */ + #ifdef PASS1COMMON #include "pass1.h" #else *************** *** 7,12 **** --- 9,15 ---- #include "pass2.h" #endif #endif + #include #ifdef FORT #undef BUFSTDERR *************** *** 14,22 **** #ifndef ONEPASS #undef BUFSTDERR #endif - # ifndef EXIT - # define EXIT exit - # endif int nerrors = 0; /* number of errors */ --- 17,22 ---- *************** *** 26,33 **** * this strangeness is due to offsets being measured in terms of bits * rather than bytes. normally "i=16" and "off=0100000" are returned, * but this is not enough to measure structures/arrays greater than ! * 32k bits (4kb). We return ! * the return value from this is multiplied by 8 (# bits/byte). */ OFFSZ caloff(){ --- 26,32 ---- * this strangeness is due to offsets being measured in terms of bits * rather than bytes. normally "i=16" and "off=0100000" are returned, * but this is not enough to measure structures/arrays greater than ! * 32k bits (4kb). */ OFFSZ caloff(){ *************** *** 51,98 **** NODE *lastfree; /* pointer to last free node; (for allocator) */ /* VARARGS1 */ ! uerror( s, a ) char *s; { /* nonfatal error message */ ! /* the routine where is different for pass 1 and pass 2; /* it tells where the error took place */ ++nerrors; where('u'); ! fprintf( stderr, s, a ); ! fprintf( stderr, "\n" ); #ifdef BUFSTDERR fflush(stderr); #endif ! if( nerrors > 30 ) cerror( "too many errors"); } /* VARARGS1 */ ! cerror( s, a, b, c ) char *s; { /* compiler error: die */ where('c'); ! fprintf( stderr, "compiler error: " ); ! fprintf( stderr, s, a, b, c ); ! fprintf( stderr, "\n" ); ! if( nerrors && nerrors <= 30 ) /* give the compiler the benefit of the doubt */ ! fprintf( stderr, "cannot recover from earlier errors: goodbye!\n" ); #ifdef BUFSTDERR fflush(stderr); #endif ! EXIT(1); } int Wflag = 0; /* Non-zero means do not print warnings */ /* VARARGS1 */ ! werror( s, a, b ) char *s; { /* warning */ ! if(Wflag) return; where('w'); ! fprintf( stderr, "warning: " ); ! fprintf( stderr, s, a, b ); ! fprintf( stderr, "\n" ); #ifdef BUFSTDERR fflush(stderr); #endif } tinit(){ /* initialize expression tree search */ register NODE *p; --- 50,136 ---- NODE *lastfree; /* pointer to last free node; (for allocator) */ /* VARARGS1 */ ! uerror(s, a ) ! unsigned short s; ! void *a; ! { /* nonfatal error message */ ! char msg[256]; ! ! /* the routine 'where' is different for pass 1 and pass 2; /* it tells where the error took place */ ++nerrors; where('u'); ! errprep(s, msg); ! fprintf(stderr, msg, a ); ! fprintf(stderr, "\n" ); #ifdef BUFSTDERR fflush(stderr); #endif ! if (nerrors > 30) cerror("too many errors"); } /* VARARGS1 */ ! cerror(s, a, b, c ) ! unsigned short s; /* stringfile offset */ ! void *a, *b, *c; ! { /* compiler error: die */ ! char msg[256]; ! where('c'); ! errprep(s, msg); ! fprintf(stderr, "compiler error: " ); ! fprintf(stderr, msg, a, b, c ); ! fprintf(stderr, "\n" ); ! /* give the compiler the benefit of the doubt */ ! if (nerrors && nerrors <= 30) ! fprintf(stderr,"cannot recover from earlier errors: goodbye!\n"); #ifdef BUFSTDERR fflush(stderr); #endif ! exit(1); } int Wflag = 0; /* Non-zero means do not print warnings */ /* VARARGS1 */ ! werror(s, a, b ) ! unsigned short s; ! void *a, *b; ! { /* warning */ ! char msg[256]; ! ! if (Wflag) return; where('w'); ! errprep(s, msg); ! fprintf(stderr, "warning: " ); ! fprintf(stderr, msg, a, b ); ! fprintf(stderr, "\n" ); #ifdef BUFSTDERR fflush(stderr); #endif } + errprep(soff, buf) + unsigned short soff; + char *buf; + { + static int errfd = -1; + + if (errfd < 0) + { + errfd = open(StringFile, O_RDONLY, 0); + if (errfd < 0) + { + fprintf(stderr, "can't open %s\n", StringFile); + fflush(stderr); + exit(1); + } + } + (void)lseek(errfd, (long)soff, L_SET); + (void)read(errfd, buf, 256); + } + tinit(){ /* initialize expression tree search */ register NODE *p; *************** *** 112,118 **** for( p = TNEXT(q); p!=q; p= TNEXT(p)) if( p->in.op ==FREE ) return(lastfree=p); ! cerror( "out of tree space; simplify expression"); /* NOTREACHED */ } --- 150,156 ---- for( p = TNEXT(q); p!=q; p= TNEXT(p)) if( p->in.op ==FREE ) return(lastfree=p); ! cerror("out of tree space; simplify expression"); /* NOTREACHED */ } *************** *** 122,128 **** if( !nerrors ) for( p=node; p<= &node[TREESZ-1]; ++p ) ! if( p->in.op != FREE ) cerror( "wasted space: %o", p ); tinit(); #ifdef FLEXNAMES freetstr(); --- 160,166 ---- if( !nerrors ) for( p=node; p<= &node[TREESZ-1]; ++p ) ! if( p->in.op != FREE ) cerror("wasted space: %o", p ); tinit(); #ifdef FLEXNAMES freetstr(); *************** *** 137,143 **** } tfree1(p) NODE *p; { ! if( p == 0 ) cerror( "freeing blank tree!"); else p->in.op = FREE; } --- 175,181 ---- } tfree1(p) NODE *p; { ! if( p == 0 ) cerror("freeing blank tree!"); else p->in.op = FREE; } *** /usr/src/lib/mip/config.h.old Thu Aug 15 16:29:25 1991 --- /usr/src/lib/mip/config.h Tue Jan 17 23:59:48 1995 *************** *** 1,4 **** ! /* config.h 4.3 85/08/22 */ #ifndef _CONFIG_ #define _CONFIG_ --- 1,4 ---- ! /* config.h 4.3.1 95/01/17 */ #ifndef _CONFIG_ #define _CONFIG_ *************** *** 21,33 **** * Table sizes. */ #ifndef FORT ! #define TREESZ 300 #else #define TREESZ 1000 /* parse tree table size */ #endif #define BCSZ 100 /* break/continue table size */ ! #define SYMTSZ 800 /* symbol table size */ ! #define DIMTABSZ 990 /* dimension/size table size */ #define PARAMSZ 130 /* parameter stack size */ #define SWITSZ 210 /* switch table size */ #define DELAYS 20 /* delayed evaluation table size */ --- 21,33 ---- * Table sizes. */ #ifndef FORT ! #define TREESZ 270 #else #define TREESZ 1000 /* parse tree table size */ #endif #define BCSZ 100 /* break/continue table size */ ! #define SYMTSZ 925 /* symbol table size */ ! #define DIMTABSZ 1050 /* dimension/size table size */ #define PARAMSZ 130 /* parameter stack size */ #define SWITSZ 210 /* switch table size */ #define DELAYS 20 /* delayed evaluation table size */ *** /usr/src/lib/mip/fort.c.old Sat Aug 17 13:43:19 1991 --- /usr/src/lib/mip/fort.c Wed Jan 18 00:01:09 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)fort.c 4.7 (Berkeley) 8/22/85"; #endif lint # ifndef FORT --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)fort.c 4.7.1 (2.11BSD GTE) 1/17/95"; #endif lint # ifndef FORT *************** *** 64,70 **** # ifndef NOLREAD long lread(){ static long x; ! if( fread( (char *) &x, 4, 1, lrd ) <= 0 ) cerror( "intermediate file read error" ); return( x ); } # endif --- 64,70 ---- # ifndef NOLREAD long lread(){ static long x; ! if( fread( (char *) &x, 4, 1, lrd ) <= 0 ) cerror("intermediate file read error" ); return( x ); } # endif *************** *** 74,80 **** /* if null, opens the standard input */ if( *s ){ lrd = fopen( s, "r" ); ! if( lrd == NULL ) cerror( "cannot open intermediate file %s", s ); } else lrd = stdin; } --- 74,80 ---- /* if null, opens the standard input */ if( *s ){ lrd = fopen( s, "r" ); ! if( lrd == NULL ) cerror("cannot open intermediate file %s", s ); } else lrd = stdin; } *************** *** 83,89 **** # ifndef NOLCREAD lcread( cp, n ) char *cp; { if( n > 0 ){ ! if( fread( cp, 4, n, lrd ) != n ) cerror( "intermediate file read error" ); } } # endif --- 83,89 ---- # ifndef NOLCREAD lcread( cp, n ) char *cp; { if( n > 0 ){ ! if( fread( cp, 4, n, lrd ) != n ) cerror("intermediate file read error" ); } } # endif *************** *** 93,103 **** register i; static char fbuf[128]; if( n > 0 ){ ! if( n > sizeof(fbuf)/4 ) cerror( "lccopy asked to copy too much" ); ! if( fread( fbuf, 4, n, lrd ) != n ) cerror( "intermediate file read error" ); for( i=4*n; fbuf[i-1] == '\0' && i>0; --i ) { /* VOID */ } if( i ) { ! if( fwrite( fbuf, 1, i, stdout ) != i ) cerror( "output file error" ); } } } --- 93,103 ---- register i; static char fbuf[128]; if( n > 0 ){ ! if( n > sizeof(fbuf)/4 ) cerror("lccopy asked to copy too much" ); ! if( fread( fbuf, 4, n, lrd ) != n ) cerror("intermediate file read error" ); for( i=4*n; fbuf[i-1] == '\0' && i>0; --i ) { /* VOID */ } if( i ) { ! if( fwrite( fbuf, 1, i, stdout ) != i ) cerror("output file error" ); } } } *************** *** 174,180 **** return( nerrors ); case FSWITCH: ! uerror( "switch not yet done" ); for( x=VAL(x); x>0; --x ) lread(); continue; --- 174,180 ---- return( nerrors ); case FSWITCH: ! uerror("switch not yet done" ); for( x=VAL(x); x>0; --x ) lread(); continue; *************** *** 201,207 **** p->in.su = 0; p->in.rall = NOPREF; *fsp++ = p; ! if( fsp >= &fstack[NSTACKSZ] ) uerror( "expression depth exceeded" ); continue; case NAME: --- 201,207 ---- p->in.su = 0; p->in.rall = NOPREF; *fsp++ = p; ! if( fsp >= &fstack[NSTACKSZ] ) uerror("expression depth exceeded" ); continue; case NAME: *************** *** 250,256 **** lineno = REST(x); if( VAL(x) ) lcread( filename, VAL(x) ); if( fsp == fstack ) continue; /* filename only */ ! if( --fsp != fstack ) uerror( "expression poorly formed" ); if( lflag ) lineid( lineno, filename ); tmpoff = baseoff; p = fstack[0]; --- 250,256 ---- lineno = REST(x); if( VAL(x) ) lcread( filename, VAL(x) ); if( fsp == fstack ) continue; /* filename only */ ! if( --fsp != fstack ) uerror("expression poorly formed" ); if( lflag ) lineid( lineno, filename ); tmpoff = baseoff; p = fstack[0]; *************** *** 315,321 **** goto bump; case LTYPE: ! uerror( "illegal leaf node: %d", p->in.op ); exit( 1 ); } } --- 315,321 ---- goto bump; case LTYPE: ! uerror("illegal leaf node: %d", p->in.op ); exit( 1 ); } } *** /usr/src/lib/mip/manifest.h.old Tue Jun 25 15:22:19 1991 --- /usr/src/lib/mip/manifest.h Wed Jan 18 00:01:41 1995 *************** *** 1,4 **** ! /* manifest.h 4.1 85/03/19 */ #ifndef _MANIFEST_ #define _MANIFEST_ --- 1,4 ---- ! /* manifest.h 4.1.1 95/01/17 */ #ifndef _MANIFEST_ #define _MANIFEST_ *************** *** 21,27 **** /* * Bogus type values */ ! #define TNULL PTR /* pointer to UNDEF */ #define TVOID FTN /* function returning UNDEF (for void) */ /* --- 21,27 ---- /* * Bogus type values */ ! #define TNULL INCREF(MOETY) /* pointer to MOETY -- impossible type */ #define TVOID FTN /* function returning UNDEF (for void) */ /* *** /usr/src/lib/mip/match.c.old Sat Aug 17 13:44:24 1991 --- /usr/src/lib/mip/match.c Wed Jan 18 00:02:53 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)match.c 4.4 (Berkeley) 8/22/85"; #endif lint # include "pass2.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)match.c 4.4.1 (2.11BSD GTE) 1/17/95"; #endif lint # include "pass2.h" *************** *** 229,235 **** goto more; } } ! cerror( "bad setrew" ); more: --- 229,235 ---- goto more; } } ! cerror("bad setrew" ); more: *************** *** 438,444 **** return( optype( p->in.op ) != BITYPE ? p : p->in.right ); } ! cerror( "bad getlr: %c", c ); /* NOTREACHED */ } # ifdef MULTILEVEL --- 438,444 ---- return( optype( p->in.op ) != BITYPE ? p : p->in.right ); } ! cerror("bad getlr: %c", c ); /* NOTREACHED */ } # ifdef MULTILEVEL *** /usr/src/lib/mip/pftn.c.old Sat Aug 17 13:58:56 1991 --- /usr/src/lib/mip/pftn.c Wed Jan 18 00:06:07 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)pftn.c 1.12 (Berkeley) 4/21/86"; #endif lint # include "pass1.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)pftn.c 1.12.1 (2.11BSD GTE) 1/17/95"; #endif lint # include "pass1.h" *************** *** 45,55 **** if( q == NIL ) return; /* an error was detected */ ! if( q < node || q >= &node[TREESZ] ) cerror( "defid call" ); idp = q->tn.rval; ! if( idp < 0 ) cerror( "tyreduce" ); p = &stab[idp]; # ifndef BUG1 --- 45,55 ---- if( q == NIL ) return; /* an error was detected */ ! if( q < node || q >= &node[TREESZ] ) cerror("defid call" ); idp = q->tn.rval; ! if( idp < 0 ) cerror("tyreduce" ); p = &stab[idp]; # ifndef BUG1 *************** *** 90,98 **** default: #ifndef FLEXNAMES ! if(!(class&FIELD)) uerror( "declared argument %.8s is missing", p->sname ); #else ! if(!(class&FIELD)) uerror( "declared argument %s is missing", p->sname ); #endif case MOS: case STNAME: --- 90,98 ---- default: #ifndef FLEXNAMES ! if(!(class&FIELD)) uerror("declared argument %.8s is missing", p->sname ); #else ! if(!(class&FIELD)) uerror("declared argument %s is missing", p->sname ); #endif case MOS: case STNAME: *************** *** 283,291 **** goto enter; } #ifndef FLEXNAMES ! uerror( "redeclaration of %.8s", p->sname ); #else ! uerror( "redeclaration of %s", p->sname ); #endif if( class==EXTDEF && ISFTN(type) ) curftn = idp; return; --- 283,291 ---- goto enter; } #ifndef FLEXNAMES ! uerror("redeclaration of %.8s", p->sname ); #else ! uerror("redeclaration of %s", p->sname ); #endif if( class==EXTDEF && ISFTN(type) ) curftn = idp; return; *************** *** 377,383 **** register int l = p->slevel; if( l >= MAXSCOPES ) ! cerror( "scopes nested too deep" ); p->snext = schain[l]; schain[l] = p; --- 377,383 ---- register int l = p->slevel; if( l >= MAXSCOPES ) ! cerror("scopes nested too deep" ); p->snext = schain[l]; schain[l] = p; *************** *** 397,403 **** psave( i ) OFFSZ i;{ if( paramno >= PARAMSZ ){ ! cerror( "parameter stack overflow"); } paramstk[ paramno++ ] = i; } --- 397,403 ---- psave( i ) OFFSZ i;{ if( paramno >= PARAMSZ ){ ! cerror("parameter stack overflow"); } paramstk[ paramno++ ] = i; } *************** *** 415,421 **** if( nerrors == 0 ){ if( psavbc != & asavbc[0] ) cerror("bcsave error"); if( paramno != 0 ) cerror("parameter reset error"); ! if( swx != 0 ) cerror( "switch error"); } psavbc = &asavbc[0]; paramno = 0; --- 415,421 ---- if( nerrors == 0 ){ if( psavbc != & asavbc[0] ) cerror("bcsave error"); if( paramno != 0 ) cerror("parameter reset error"); ! if( swx != 0 ) cerror("switch error"); } psavbc = &asavbc[0]; paramno = 0; *************** *** 582,588 **** for( i = oparam+4; i< paramno; ++i ){ dstash( j=paramstk[i] ); ! if( j<0 || j>= SYMTSZ ) cerror( "gummy structure member" ); p = &stab[j]; if( temp == ENUMTY ){ if( p->offset < low ) low = p->offset; --- 582,588 ---- for( i = oparam+4; i< paramno; ++i ){ dstash( j=paramstk[i] ); ! if( j<0 || j>= SYMTSZ ) cerror("gummy structure member" ); p = &stab[j]; if( temp == ENUMTY ){ if( p->offset < low ) low = p->offset; *************** *** 599,607 **** } if( sz == 0 ){ #ifndef FLEXNAMES ! werror( "illegal zero sized structure member: %.8s", p->sname ); #else ! werror( "illegal zero sized structure member: %s", p->sname ); #endif } if( sz > strucoff ) strucoff = sz; /* for use with unions */ --- 599,607 ---- } if( sz == 0 ){ #ifndef FLEXNAMES ! werror("illegal zero sized structure member: %.8s", p->sname ); #else ! werror("illegal zero sized structure member: %s", p->sname ); #endif } if( sz > strucoff ) strucoff = sz; /* for use with unions */ *************** *** 625,631 **** dimtab[ szindex+2 ] = al = talign( ty, (int)ty ); } ! if( strucoff == 0 ) uerror( "zero sized structure" ); dimtab[ szindex ] = strucoff; dimtab[ szindex+2 ] = al; dimtab[ szindex+3 ] = paramstk[ oparam+3 ]; /* name index */ --- 625,631 ---- dimtab[ szindex+2 ] = al = talign( ty, (int)ty ); } ! if( strucoff == 0 ) uerror("zero sized structure" ); dimtab[ szindex ] = strucoff; dimtab[ szindex+2 ] = al; dimtab[ szindex+3 ] = paramstk[ oparam+3 ]; /* name index */ *************** *** 652,660 **** } /* VARARGS */ ! yyerror( s ) char *s; { /* error printing routine in parser */ ! uerror( s ); } --- 652,660 ---- } /* VARARGS */ ! yyerror(s ) char *s; { /* error printing routine in parser */ ! uerror(s ); } *************** *** 707,713 **** switch( (ty>>i)&TMASK ){ case FTN: ! cerror( "compiler takes alignment of function"); case PTR: return( ALPOINT ); case ARY: --- 707,713 ---- switch( (ty>>i)&TMASK ){ case FTN: ! cerror("compiler takes alignment of function"); case PTR: return( ALPOINT ); case ARY: *************** *** 756,762 **** switch( (ty>>i)&TMASK ){ case FTN: ! cerror( "compiler takes size of function"); case PTR: return( SZPOINT * mult ); case ARY: --- 756,762 ---- switch( (ty>>i)&TMASK ){ case FTN: ! cerror("compiler takes size of function"); case PTR: return( SZPOINT * mult ); case ARY: *************** *** 770,778 **** if( dimtab[s]==0 ) { if( ty == STRTY ) ! uerror( "undefined structure" ); else ! uerror( "unknown size"); return( SZINT ); } return( dimtab[ s ] * mult ); --- 770,778 ---- if( dimtab[s]==0 ) { if( ty == STRTY ) ! uerror("undefined structure" ); else ! uerror("unknown size"); return( SZINT ); } return( dimtab[ s ] * mult ); *************** *** 786,792 **** if( inoff == n ) return; if( inoff > n ) { ! cerror( "initialization alignment error"); } wb = inoff; --- 786,792 ---- if( inoff == n ) return; if( inoff > n ) { ! cerror("initialization alignment error"); } wb = inoff; *************** *** 814,820 **** rest = n-inoff; vfdzero( rest ); ! if( inoff != n ) cerror( "inoff error"); } --- 814,820 ---- rest = n-inoff; vfdzero( rest ); ! if( inoff != n ) cerror("inoff error"); } *************** *** 912,918 **** } if( (iclass==AUTO || iclass == REGISTER ) && ! (ISARY(t) || t==STRTY) ) uerror( "no automatic aggregate initialization" ); /* now, if this is not a scalar, put on another element */ --- 912,918 ---- } if( (iclass==AUTO || iclass == REGISTER ) && ! (ISARY(t) || t==STRTY) ) uerror("no automatic aggregate initialization" ); /* now, if this is not a scalar, put on another element */ *************** *** 923,935 **** } else if( t == STRTY ){ if( dimtab[pstk->in_s] == 0 ){ ! uerror( "can't initialize undefined structure" ); iclass = -1; return; } id = (int)dimtab[pstk->in_x]; p = &stab[id]; ! if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror( "insane structure member list" ); t = p->stype; d = p->dimoff; s = p->sizoff; --- 923,935 ---- } else if( t == STRTY ){ if( dimtab[pstk->in_s] == 0 ){ ! uerror("can't initialize undefined structure" ); iclass = -1; return; } id = (int)dimtab[pstk->in_x]; p = &stab[id]; ! if( p->sclass != MOS && !(p->sclass&FIELD) ) cerror("insane structure member list" ); t = p->stype; d = p->dimoff; s = p->sizoff; *************** *** 1017,1024 **** inforce( tsize( t, d, s ) ); n = d1; } ! if( d1!=0 && d1!=n ) uerror( "too many initializers"); ! if( n==0 ) werror( "empty array declaration"); dimtab[d] = n; if( d1==0 ) FIXDEF(&stab[pstk->in_id]); } --- 1017,1024 ---- inforce( tsize( t, d, s ) ); n = d1; } ! if( d1!=0 && d1!=n ) uerror("too many initializers"); ! if( n==0 ) werror("empty array declaration"); dimtab[d] = n; if( d1==0 ) FIXDEF(&stab[pstk->in_id]); } *************** *** 1027,1033 **** /* clearly not fields either */ inforce( tsize( t, d, s ) ); } ! else if( n > 1 ) uerror( "bad scalar initialization"); /* this will never be called with a field element... */ else inforce( tsize(t,d,s) ); --- 1027,1033 ---- /* clearly not fields either */ inforce( tsize( t, d, s ) ); } ! else if( n > 1 ) uerror("bad scalar initialization"); /* this will never be called with a field element... */ else inforce( tsize(t,d,s) ); *************** *** 1053,1059 **** if( iclass < 0 ) goto leave; if( iclass == EXTERN || iclass == UNAME ){ ! uerror( "cannot initialize extern or union" ); iclass = -1; goto leave; } --- 1053,1059 ---- if( iclass < 0 ) goto leave; if( iclass == EXTERN || iclass == UNAME ){ ! uerror("cannot initialize extern or union" ); iclass = -1; goto leave; } *************** *** 1071,1082 **** if( p == NIL ) return; /* for throwing away strings that have been turned into lists */ if( ifull ){ ! uerror( "too many initializers" ); iclass = -1; goto leave; } if( ibseen ){ ! uerror( "} expected"); goto leave; } --- 1071,1082 ---- if( p == NIL ) return; /* for throwing away strings that have been turned into lists */ if( ifull ){ ! uerror("too many initializers" ); iclass = -1; goto leave; } if( ibseen ){ ! uerror("} expected"); goto leave; } *************** *** 1109,1115 **** p->in.op = INIT; if( sz < SZINT ){ /* special case: bit fields, etc. */ ! if( o != ICON ) uerror( "illegal initialization" ); else incode( p->in.left, sz ); } else if( o == FCON ){ --- 1109,1115 ---- p->in.op = INIT; if( sz < SZINT ){ /* special case: bit fields, etc. */ ! if( o != ICON ) uerror("illegal initialization" ); else incode( p->in.left, sz ); } else if( o == FCON ){ *************** *** 1120,1126 **** } else { p = optim(p); ! if( p->in.left->in.op != ICON ) uerror( "illegal initialization" ); else cinit( p, sz ); } --- 1120,1126 ---- } else { p = optim(p); ! if( p->in.left->in.op != ICON ) uerror("illegal initialization" ); else cinit( p, sz ); } *************** *** 1181,1187 **** t = pstk->in_t; if( t != STRTY && !ISARY(t) ) continue; /* not an aggregate */ if( pstk->in_fl ){ /* already associated with a { */ ! if( pstk->in_n ) uerror( "illegal {"); continue; } --- 1181,1187 ---- t = pstk->in_t; if( t != STRTY && !ISARY(t) ) continue; /* not an aggregate */ if( pstk->in_fl ){ /* already associated with a { */ ! if( pstk->in_n ) uerror("illegal {"); continue; } *************** *** 1326,1332 **** default: if( new < 0 ) { ! uerror( "illegal field type" ); al = ALINT; } else { --- 1326,1332 ---- default: if( new < 0 ) { ! uerror("illegal field type" ); al = ALINT; } else { *************** *** 1336,1348 **** } if( w > sz ) { ! uerror( "field too big"); w = sz; } if( w == 0 ){ /* align only */ SETOFF( strucoff, al ); ! if( new >= 0 ) uerror( "zero size field"); return(0); } --- 1336,1348 ---- } if( w > sz ) { ! uerror("field too big"); w = sz; } if( w == 0 ){ /* align only */ SETOFF( strucoff, al ); ! if( new >= 0 ) uerror("zero size field"); return(0); } *************** *** 1377,1383 **** /* compute class */ if( (class=curclass) == SNULL ){ if( blevel > 1 ) class = AUTO; ! else if( blevel != 0 || instruct ) cerror( "nidcl error" ); else { /* blevel = 0 */ class = noinit(); if( class == EXTERN ) commflag = 1; --- 1377,1383 ---- /* compute class */ if( (class=curclass) == SNULL ){ if( blevel > 1 ) class = AUTO; ! else if( blevel != 0 || instruct ) cerror("nidcl error" ); else { /* blevel = 0 */ class = noinit(); if( class == EXTERN ) commflag = 1; *************** *** 1438,1444 **** default: bad: ! uerror( "illegal type combination" ); return( INT ); case UNDEF: --- 1438,1444 ---- default: bad: ! uerror("illegal type combination" ); return( INT ); case UNDEF: *************** *** 1486,1492 **** register i; extern int eprint(); ! if( typ->in.op != TYPE ) cerror( "tymerge: arg 1" ); if(idp == NIL ) return( NIL ); # ifndef BUG1 --- 1486,1492 ---- register i; extern int eprint(); ! if( typ->in.op != TYPE ) cerror("tymerge: arg 1" ); if(idp == NIL ) return( NIL ); # ifndef BUG1 *************** *** 1533,1539 **** temp = p->in.right->tn.lval; p->in.right->in.op = FREE; if( ( temp == 0 ) & ( p->in.left->tn.op == LB ) ) ! uerror( "Null dimension" ); } p->in.left->in.type = t; --- 1533,1539 ---- temp = p->in.right->tn.lval; p->in.right->in.op = FREE; if( ( temp == 0 ) & ( p->in.left->tn.op == LB ) ) ! uerror("Null dimension" ); } p->in.left->in.type = t; *************** *** 1556,1566 **** t = DECREF(type); while( mod1=mod2, mod2 = (t&TMASK) ){ if( mod1 == ARY && mod2 == FTN ){ ! uerror( "array of functions is illegal" ); type = 0; } else if( mod1 == FTN && ( mod2 == ARY || mod2 == FTN ) ){ ! uerror( "function returns illegal type" ); type = 0; } t = DECREF(t); --- 1556,1566 ---- t = DECREF(type); while( mod1=mod2, mod2 = (t&TMASK) ){ if( mod1 == ARY && mod2 == FTN ){ ! uerror("array of functions is illegal" ); type = 0; } else if( mod1 == FTN && ( mod2 == ARY || mod2 == FTN ) ){ ! uerror("function returns illegal type" ); type = 0; } t = DECREF(t); *************** *** 1579,1585 **** type += (PTR-ARY); } else if( ISFTN(type) ){ ! werror( "a function is declared as an argument" ); type = INCREF(type); } --- 1579,1585 ---- type += (PTR-ARY); } else if( ISFTN(type) ){ ! werror("a function is declared as an argument" ); type = INCREF(type); } *************** *** 1586,1592 **** } if( instruct && ISFTN(type) ){ ! uerror( "function illegal in structure or union" ); type = INCREF(type); } p->in.type = type; --- 1586,1592 ---- } if( instruct && ISFTN(type) ){ ! uerror("function illegal in structure or union" ); type = INCREF(type); } p->in.type = type; *************** *** 1618,1624 **** if( ISFTN( type ) ){ switch( class ) { default: ! uerror( "function has illegal storage class" ); case AUTO: class = EXTERN; case EXTERN: --- 1618,1624 ---- if( ISFTN( type ) ){ switch( class ) { default: ! uerror("function has illegal storage class" ); case AUTO: class = EXTERN; case EXTERN: *************** *** 1633,1639 **** } if( class&FIELD ){ ! if( !(instruct&INSTRUCT) ) uerror( "illegal use of field" ); return( class ); } --- 1633,1639 ---- } if( class&FIELD ){ ! if( !(instruct&INSTRUCT) ) uerror("illegal use of field" ); return( class ); } *************** *** 1640,1658 **** switch( class ){ case MOU: ! if( !(instruct&INUNION) ) uerror( "illegal class" ); return( class ); case MOS: ! if( !(instruct&INSTRUCT) ) uerror( "illegal class" ); return( class ); case MOE: ! if( instruct & (INSTRUCT|INUNION) ) uerror( "illegal class" ); return( class ); case REGISTER: ! if( blevel == 0 ) uerror( "illegal register declaration" ); else if( regvar >= MINRVAR && cisreg( type ) ) return( class ); if( blevel == 1 ) return( PARAM ); else return( AUTO ); --- 1640,1658 ---- switch( class ){ case MOU: ! if( !(instruct&INUNION) ) uerror("illegal class" ); return( class ); case MOS: ! if( !(instruct&INSTRUCT) ) uerror("illegal class" ); return( class ); case MOE: ! if( instruct & (INSTRUCT|INUNION) ) uerror("illegal class" ); return( class ); case REGISTER: ! if( blevel == 0 ) uerror("illegal register declaration" ); else if( regvar >= MINRVAR && cisreg( type ) ) return( class ); if( blevel == 1 ) return( PARAM ); else return( AUTO ); *************** *** 1660,1670 **** case AUTO: case LABEL: case ULABEL: ! if( blevel < 2 ) uerror( "illegal class" ); return( class ); case PARAM: ! if( blevel != 1 ) uerror( "illegal class" ); return( class ); case UFORTRAN: --- 1660,1670 ---- case AUTO: case LABEL: case ULABEL: ! if( blevel < 2 ) uerror("illegal class" ); return( class ); case PARAM: ! if( blevel != 1 ) uerror("illegal class" ); return( class ); case UFORTRAN: *************** *** 1672,1682 **** # ifdef NOFORTRAN NOFORTRAN; /* a condition which can regulate the FORTRAN usage */ # endif ! if( !ISFTN(type) ) uerror( "fortran declaration must apply to function" ); else { type = DECREF(type); if( ISFTN(type) || ISARY(type) || ISPTR(type) ) { ! uerror( "fortran function has wrong type" ); } } case EXTERN: --- 1672,1682 ---- # ifdef NOFORTRAN NOFORTRAN; /* a condition which can regulate the FORTRAN usage */ # endif ! if( !ISFTN(type) ) uerror("fortran declaration must apply to function" ); else { type = DECREF(type); if( ISFTN(type) || ISARY(type) || ISPTR(type) ) { ! uerror("fortran function has wrong type" ); } } case EXTERN: *************** *** 1685,1691 **** case TYPEDEF: case USTATIC: if( blevel == 1 ){ ! uerror( "illegal class" ); return( PARAM ); } case STNAME: --- 1685,1691 ---- case TYPEDEF: case USTATIC: if( blevel == 1 ){ ! uerror("illegal class" ); return( PARAM ); } case STNAME: *************** *** 1694,1700 **** return( class ); default: ! cerror( "illegal class: %d", class ); /* NOTREACHED */ } --- 1694,1700 ---- return( class ); default: ! cerror("illegal class: %d", class ); /* NOTREACHED */ } *************** *** 1797,1803 **** sp = stab; } else ++sp; ! if( i == ii ) cerror( "symbol table full" ); } } --- 1797,1803 ---- sp = stab; } else ++sp; ! if( i == ii ) cerror("symbol table full" ); } } *************** *** 1815,1830 **** if( q->stype == UNDEF || q->slevel <= p->slevel ){ #ifndef FLEXNAMES ! cerror( "check error: %.8s", q->sname ); #else ! cerror( "check error: %s", q->sname ); #endif } } #ifndef FLEXNAMES ! else if( p->slevel > lev ) cerror( "%.8s check at level %d", p->sname, lev ); #else ! else if( p->slevel > lev ) cerror( "%s check at level %d", p->sname, lev ); #endif } } --- 1815,1830 ---- if( q->stype == UNDEF || q->slevel <= p->slevel ){ #ifndef FLEXNAMES ! cerror("check error: %.8s", q->sname ); #else ! cerror("check error: %s", q->sname ); #endif } } #ifndef FLEXNAMES ! else if( p->slevel > lev ) cerror("%.8s check at level %d", p->sname, lev ); #else ! else if( p->slevel > lev ) cerror("%s check at level %d", p->sname, lev ); #endif } } *************** *** 1867,1880 **** q = p->snext; type = p->stype; if( p->stype == TNULL || p->slevel <= lev ) ! cerror( "schain botch" ); lineno = p->suse < 0 ? -p->suse : p->suse; if( p->stype==UNDEF || ( p->sclass==ULABEL && lev<2 ) ){ lineno = temp; #ifndef FLEXNAMES ! uerror( "%.8s undefined", p->sname ); #else ! uerror( "%s undefined", p->sname ); #endif } else aocode(p); --- 1867,1880 ---- q = p->snext; type = p->stype; if( p->stype == TNULL || p->slevel <= lev ) ! cerror("schain botch" ); lineno = p->suse < 0 ? -p->suse : p->suse; if( p->stype==UNDEF || ( p->sclass==ULABEL && lev<2 ) ){ lineno = temp; #ifndef FLEXNAMES ! uerror("%.8s undefined", p->sname ); #else ! uerror("%s undefined", p->sname ); #endif } else aocode(p); *************** *** 1930,1936 **** register struct symtab *q; for( q=p+1; ; ++q ){ if( q >= &stab[SYMTSZ] ) q = stab; ! if( q == p ) cerror( "symbol table full" ); if( q->stype == TNULL ) break; } *q = *p; --- 1930,1936 ---- register struct symtab *q; for( q=p+1; ; ++q ){ if( q >= &stab[SYMTSZ] ) q = stab; ! if( q == p ) cerror("symbol table full" ); if( q->stype == TNULL ) break; } *q = *p; *************** *** 1937,1945 **** p->sflags |= SHIDDEN; q->sflags = (p->sflags&(SMOS|STAG)) | SHIDES; #ifndef FLEXNAMES ! if( hflag ) werror( "%.8s redefinition hides earlier one", p->sname ); #else ! if( hflag ) werror( "%s redefinition hides earlier one", p->sname ); #endif # ifndef BUG1 if( ddebug ) printf( " %d hidden in %d\n", p-stab, q-stab ); --- 1937,1945 ---- p->sflags |= SHIDDEN; q->sflags = (p->sflags&(SMOS|STAG)) | SHIDES; #ifndef FLEXNAMES ! if( hflag ) werror("%.8s redefinition hides earlier one", p->sname ); #else ! if( hflag ) werror("%s redefinition hides earlier one", p->sname ); #endif # ifndef BUG1 if( ddebug ) printf( " %d hidden in %d\n", p-stab, q-stab ); *************** *** 1977,1981 **** } } ! cerror( "unhide fails" ); } --- 1977,1981 ---- } } ! cerror("unhide fails" ); } *** /usr/src/lib/mip/reader.c.old Sat Aug 17 14:00:46 1991 --- /usr/src/lib/mip/reader.c Wed Jan 18 00:07:48 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)reader.c 4.4 (Berkeley) 8/22/85"; #endif lint # include "pass2.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)reader.c 4.4.1 (2.11BSD GTE) 1/17/94"; #endif lint # include "pass2.h" *************** *** 109,115 **** #endif default: ! cerror( "bad option: %c", *cp ); } } } --- 109,115 ---- #endif default: ! cerror("bad option: %c", *cp ); } } } *************** *** 162,168 **** temp = rdin(10); /* ftnno */ tmpoff = baseoff = rdin(10); /* autooff for block gives max offset of autos in block */ maxtreg = rdin(10); ! if( getchar() != '\n' ) cerror( "intermediate file format error"); if( temp != ftnno ){ /* beginning of function */ maxoff = baseoff; --- 162,168 ---- temp = rdin(10); /* ftnno */ tmpoff = baseoff = rdin(10); /* autooff for block gives max offset of autos in block */ maxtreg = rdin(10); ! if( getchar() != '\n' ) cerror("intermediate file format error"); if( temp != ftnno ){ /* beginning of function */ maxoff = baseoff; *************** *** 181,187 **** SETOFF( maxoff, ALSTACK ); eobl2(); while( (c=getchar()) != '\n' ){ ! if( c <= 0 ) cerror( "intermediate file format eof" ); } continue; --- 181,187 ---- SETOFF( maxoff, ALSTACK ); eobl2(); while( (c=getchar()) != '\n' ){ ! if( c <= 0 ) cerror("intermediate file format eof" ); } continue; *************** *** 212,218 **** continue; default: ! cerror( "intermediate file format error" ); } --- 212,218 ---- continue; default: ! cerror("intermediate file format error" ); } *************** *** 557,563 **** switch( m ){ default: nomat: ! cerror( "no table entry for op %s", opst[p->in.op] ); case COMOP: codgen( p1, FOREFF ); --- 557,563 ---- switch( m ){ default: nomat: ! cerror("no table entry for op %s", opst[p->in.op] ); case COMOP: codgen( p1, FOREFF ); *************** *** 626,632 **** goto again; case INIT: ! uerror( "illegal initialization" ); return; case UNARY FORTCALL: --- 626,632 ---- goto again; case INIT: ! uerror("illegal initialization" ); return; case UNARY FORTCALL: *************** *** 1033,1039 **** rcount(){ /* count recursions */ if( ++nrecur > NRECUR ){ ! cerror( "expression causes compiler loop: try simplifying" ); } } --- 1033,1039 ---- rcount(){ /* count recursions */ if( ++nrecur > NRECUR ){ ! cerror("expression causes compiler loop: try simplifying" ); } } *************** *** 1114,1120 **** if( p->in.op == STASG || p->in.op == STARG || p->in.op == STCALL || p->in.op == UNARY STCALL ){ p->stn.stsize = (rdin( 10 ) + (SZCHAR-1) )/SZCHAR; p->stn.stalign = rdin(10) / SZCHAR; ! if( getchar() != '\n' ) cerror( "illegal \n" ); } else { /* usual case */ if( p->in.op == REG ) rbusy( p->tn.rval, p->in.type ); /* non usually, but sometimes justified */ --- 1114,1120 ---- if( p->in.op == STASG || p->in.op == STARG || p->in.op == STCALL || p->in.op == UNARY STCALL ){ p->stn.stsize = (rdin( 10 ) + (SZCHAR-1) )/SZCHAR; p->stn.stalign = rdin(10) / SZCHAR; ! if( getchar() != '\n' ) cerror("illegal \n" ); } else { /* usual case */ if( p->in.op == REG ) rbusy( p->tn.rval, p->in.type ); /* non usually, but sometimes justified */ *************** *** 1153,1159 **** while( (c=getchar()) > 0 ) { if( c == '-' ){ ! if( val != 0 ) cerror( "illegal -"); sign = -sign; continue; } --- 1153,1159 ---- while( (c=getchar()) > 0 ) { if( c == '-' ){ ! if( val != 0 ) cerror("illegal -"); sign = -sign; continue; } *************** *** 1166,1177 **** val -= c-'0'; continue; } ! cerror( "illegal character `%c' on intermediate file", c ); break; } if( c <= 0 ) { ! cerror( "unexpected EOF"); } return( val ); } --- 1166,1177 ---- val -= c-'0'; continue; } ! cerror("illegal character `%c' on intermediate file", c ); break; } if( c <= 0 ) { ! cerror("unexpected EOF"); } return( val ); } *** /usr/src/lib/mip/scan.c.old Sat Aug 17 14:02:12 1991 --- /usr/src/lib/mip/scan.c Wed Jan 18 00:09:18 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)scan.c 2.1 (Berkeley) 4/23/86"; #endif lint # include "pass1.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)scan.c 2.1.1 (2.11BSD GTE) 1/17/95"; #endif lint # include "pass1.h" *************** *** 325,335 **** switch( c ) { case EOF: ! uerror( "unexpected EOF" ); break; case '\n': ! uerror( "newline in string or char constant" ); ++lineno; break; --- 325,335 ---- switch( c ) { case EOF: ! uerror("unexpected EOF" ); break; case '\n': ! uerror("newline in string or char constant" ); ++lineno; break; *************** *** 403,409 **** else { /* stash the byte into the string */ if( strflg ) { if( ct==0 || i(SZINT/SZCHAR) || ( (pflag||hflag)&&i>1) ) ! uerror( "too many characters in character constant" ); } } --- 425,433 ---- } } else { /* end the character constant */ ! if( i == 0 ) uerror("empty character constant" ); if( i>(SZINT/SZCHAR) || ( (pflag||hflag)&&i>1) ) ! uerror("too many characters in character constant" ); } } *************** *** 440,446 **** switch( c = getchar() ){ case EOF: ! uerror( "unexpected EOF" ); return; case '\n': --- 440,446 ---- switch( c = getchar() ){ case EOF: ! uerror("unexpected EOF" ); return; case '\n': *************** *** 515,521 **** return( p->lxtok ); case A_ERR: ! uerror( "illegal character: %03o (octal)", lxchar ); break; case A_LET: --- 515,521 ---- return( p->lxtok ); case A_ERR: ! uerror("illegal character: %03o (octal)", lxchar ); break; case A_LET: *************** *** 550,556 **** case 'x': case 'X': ! if( yytext[0] != '0' && !yytext[1] ) uerror( "illegal hex constant" ); lxmore( lxchar, LEXHEX ); /* convert the value */ { --- 550,556 ---- case 'x': case 'X': ! if( yytext[0] != '0' && !yytext[1] ) uerror("illegal hex constant" ); lxmore( lxchar, LEXHEX ); /* convert the value */ { *************** *** 665,682 **** for( i=0; i6 ) uerror( "BCD constant exceeds 6 characters" ); # ifdef gcos else strtob( yytext, &lastcon, i ); lastcon >>= 6*(6-i); # else ! uerror( "gcos BCD constant illegal" ); # endif yylval.intval = 0; /* not long */ return( ICON ); --- 665,682 ---- for( i=0; i6 ) uerror("BCD constant exceeds 6 characters" ); # ifdef gcos else strtob( yytext, &lastcon, i ); lastcon >>= 6*(6-i); # else ! uerror("gcos BCD constant illegal" ); # endif yylval.intval = 0; /* not long */ return( ICON ); *************** *** 764,770 **** warn: if( lxmask[ (lxchar=getchar())+1] & (LEXLET|LEXDIG|LEXDOT) ){ ! werror( "ambiguous assignment: assignment op taken" ); } ungetc( lxchar ,stdin); break; --- 764,770 ---- warn: if( lxmask[ (lxchar=getchar())+1] & (LEXLET|LEXDIG|LEXDOT) ){ ! werror("ambiguous assignment: assignment op taken" ); } ungetc( lxchar ,stdin); break; *************** *** 795,801 **** case '<': if( (lxchar=getchar()) != '<' ){ ! uerror( "=<%c illegal", lxchar ); } yylval.intval = ASG LS; break; --- 795,801 ---- case '<': if( (lxchar=getchar()) != '<' ){ ! uerror("=<%c illegal", lxchar ); } yylval.intval = ASG LS; break; *************** *** 802,808 **** case '>': if( (lxchar=getchar()) != '>' ){ ! uerror( "=>%c illegal", lxchar ); } yylval.intval = ASG RS; break; --- 802,808 ---- case '>': if( (lxchar=getchar()) != '>' ){ ! uerror("=>%c illegal", lxchar ); } yylval.intval = ASG RS; break; *************** *** 815,826 **** return( ASOP ); default: ! cerror( "yylex error, character %03o (octal)", lxchar ); } /* ordinarily, repeat here... */ ! cerror( "out of switch in yylex" ); } --- 815,826 ---- return( ASOP ); default: ! cerror("yylex error, character %03o (octal)", lxchar ); } /* ordinarily, repeat here... */ ! cerror("out of switch in yylex" ); } *************** *** 979,989 **** return( 0 ); badasm: ! uerror( "bad asm construction" ); return( 0 ); default: ! cerror( "bad AR_?? action" ); } } } --- 979,989 ---- return( 0 ); badasm: ! uerror("bad asm construction" ); return( 0 ); default: ! cerror("bad AR_?? action" ); } } } *** /usr/src/lib/mip/trees.c.old Sat Aug 17 14:04:54 1991 --- /usr/src/lib/mip/trees.c Tue Jan 17 23:55:03 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)trees.c 4.10 (Berkeley) 1/8/86"; #endif # include "pass1.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char *sccsid ="@(#)trees.c 4.10.1 (2.11BSD GTE) 1/17/95"; #endif # include "pass1.h" *************** *** 102,108 **** switch( o ){ case NOT: ! if( hflag ) werror( "constant argument to NOT" ); case UNARY MINUS: case COMPL: if( conval( l, o, l ) ) return(l); --- 102,108 ---- switch( o ){ case NOT: ! if( hflag ) werror("constant argument to NOT" ); case UNARY MINUS: case COMPL: if( conval( l, o, l ) ) return(l); *************** *** 155,161 **** case CBRANCH: ccwarn: ! if( hflag ) werror( "constant in conditional context" ); case PLUS: case MINUS: --- 155,161 ---- case CBRANCH: ccwarn: ! if( hflag ) werror("constant in conditional context" ); case PLUS: case MINUS: *************** *** 238,244 **** if( actions&LVAL ){ /* check left descendent */ if( notlval(p->in.left) ) { ! uerror( "illegal lhs of assignment operator" ); } } --- 238,244 ---- if( actions&LVAL ){ /* check left descendent */ if( notlval(p->in.left) ) { ! uerror("illegal lhs of assignment operator" ); } } *************** *** 284,292 **** sp = &stab[idname]; if( sp->stype == UNDEF ){ #ifndef FLEXNAMES ! uerror( "%.8s undefined", sp->sname ); #else ! uerror( "%s undefined", sp->sname ); #endif /* make p look reasonable */ p->in.type = p->fn.cdim = p->fn.csiz = INT; --- 284,292 ---- sp = &stab[idname]; if( sp->stype == UNDEF ){ #ifndef FLEXNAMES ! uerror("%.8s undefined", sp->sname ); #else ! uerror("%s undefined", sp->sname ); #endif /* make p look reasonable */ p->in.type = p->fn.cdim = p->fn.csiz = INT; *************** *** 347,353 **** i = r->tn.rval; if( i<0 || ((sp= &stab[i])->sclass != MOS && sp->sclass != MOU && !(sp->sclass&FIELD)) ){ ! uerror( "member of structure or union required" ); }else /* if this name is non-unique, find right one */ if( stab[i].sflags & SNONUNIQ && --- 347,353 ---- i = r->tn.rval; if( i<0 || ((sp= &stab[i])->sclass != MOS && sp->sclass != MOU && !(sp->sclass&FIELD)) ){ ! uerror("member of structure or union required" ); }else /* if this name is non-unique, find right one */ if( stab[i].sflags & SNONUNIQ && *************** *** 400,415 **** register j; if( l->in.type != PTR+STRTY && l->in.type != PTR+UNIONTY ){ if( stab[i].sflags & SNONUNIQ ){ ! uerror( "nonunique name demands struct/union or struct/union pointer" ); } ! else werror( "struct/union or struct/union pointer required" ); } ! else if( (j=l->fn.csiz+1)<0 ) cerror( "undefined structure or union" ); else if( !chkstr( i, (int)dimtab[j], DECREF(l->in.type) ) ){ #ifndef FLEXNAMES ! werror( "illegal member use: %.8s", stab[i].sname ); #else ! werror( "illegal member use: %s", stab[i].sname ); #endif } } --- 400,415 ---- register j; if( l->in.type != PTR+STRTY && l->in.type != PTR+UNIONTY ){ if( stab[i].sflags & SNONUNIQ ){ ! uerror("nonunique name demands struct/union or struct/union pointer" ); } ! else werror("struct/union or struct/union pointer required" ); } ! else if( (j=l->fn.csiz+1)<0 ) cerror("undefined structure or union" ); else if( !chkstr( i, (int)dimtab[j], DECREF(l->in.type) ) ){ #ifndef FLEXNAMES ! werror("illegal member use: %.8s", stab[i].sname ); #else ! werror("illegal member use: %s", stab[i].sname ); #endif } } *************** *** 471,477 **** # endif default: ! uerror( "unacceptable operand of &" ); break; } break; --- 471,477 ---- # endif default: ! uerror("unacceptable operand of &" ); break; } break; *************** *** 496,502 **** register TWORD t; register d, s; ! if( l->fn.csiz != r->fn.csiz ) uerror( "assignment of different structures" ); r = buildtree( UNARY AND, r, NIL ); t = r->in.type; --- 496,502 ---- register TWORD t; register d, s; ! if( l->fn.csiz != r->fn.csiz ) uerror("assignment of different structures" ); r = buildtree( UNARY AND, r, NIL ); t = r->in.type; *************** *** 519,525 **** case COLON: /* structure colon */ ! if( l->fn.csiz != r->fn.csiz ) uerror( "type clash in conditional" ); break; case CALL: --- 519,525 ---- case COLON: /* structure colon */ ! if( l->fn.csiz != r->fn.csiz ) uerror("type clash in conditional" ); break; case CALL: *************** *** 548,554 **** break; default: ! cerror( "other code %d", o ); } } --- 548,554 ---- break; default: ! cerror("other code %d", o ); } } *************** *** 615,625 **** if( ddebug > 1 ) printf( "chkstr( %s(%d), %d )\n", stab[i].sname, i, j ); #endif # endif ! if( (k = j) < 0 ) uerror( "undefined structure or union" ); else { for( ; (kk = (int)dimtab[k] ) >= 0; ++k ){ if( kk >= SYMTSZ ){ ! cerror( "gummy structure" ); return(1); } if( kk == i ) return( 1 ); --- 615,625 ---- if( ddebug > 1 ) printf( "chkstr( %s(%d), %d )\n", stab[i].sname, i, j ); #endif # endif ! if( (k = j) < 0 ) uerror("undefined structure or union" ); else { for( ; (kk = (int)dimtab[k] ) >= 0; ++k ){ if( kk >= SYMTSZ ){ ! cerror("gummy structure" ); return(1); } if( kk == i ) return( 1 ); *************** *** 674,685 **** p->tn.lval *= val; break; case DIV: ! if( val == 0 ) uerror( "division by 0" ); else if ( u ) p->tn.lval = (unsigned) p->tn.lval / val; else p->tn.lval /= val; break; case MOD: ! if( val == 0 ) uerror( "division by 0" ); else if ( u ) p->tn.lval = (unsigned) p->tn.lval % val; else p->tn.lval %= val; break; --- 674,685 ---- p->tn.lval *= val; break; case DIV: ! if( val == 0 ) uerror("division by 0" ); else if ( u ) p->tn.lval = (unsigned) p->tn.lval / val; else p->tn.lval /= val; break; case MOD: ! if( val == 0 ) uerror("division by 0" ); else if ( u ) p->tn.lval = (unsigned) p->tn.lval % val; else p->tn.lval %= val; break; *************** *** 769,779 **** if( t1==ENUMTY || t2==ENUMTY ) { /* check for enumerations */ if( logop( p->in.op ) && p->in.op != EQ && p->in.op != NE ) { ! uerror( "illegal comparison of enums" ); return; } if( t1==ENUMTY && t2==ENUMTY && p->in.left->fn.csiz==p->in.right->fn.csiz ) return; ! werror( "enumeration type clash, operator %s", opst[p->in.op] ); return; } --- 769,779 ---- if( t1==ENUMTY || t2==ENUMTY ) { /* check for enumerations */ if( logop( p->in.op ) && p->in.op != EQ && p->in.op != NE ) { ! uerror("illegal comparison of enums" ); return; } if( t1==ENUMTY && t2==ENUMTY && p->in.left->fn.csiz==p->in.right->fn.csiz ) return; ! werror("enumeration type clash, operator %s", opst[p->in.op] ); return; } *************** *** 782,788 **** if( !ISPTR(q->in.type) && !ISARY(q->in.type) ){ if( q->in.op != ICON || q->tn.lval != 0 ){ ! werror( "illegal combination of pointer and integer, op %s", opst[p->in.op] ); } } --- 782,788 ---- if( !ISPTR(q->in.type) && !ISARY(q->in.type) ){ if( q->in.op != ICON || q->tn.lval != 0 ){ ! werror("illegal combination of pointer and integer, op %s", opst[p->in.op] ); } } *************** *** 792,798 **** for( ;; ){ if( t1 == t2 ) {; if( p->in.left->fn.csiz != p->in.right->fn.csiz ) { ! werror( "illegal structure pointer combination" ); } return; } --- 792,798 ---- for( ;; ){ if( t1 == t2 ) {; if( p->in.left->fn.csiz != p->in.right->fn.csiz ) { ! werror("illegal structure pointer combination" ); } return; } *************** *** 799,805 **** if( ISARY(t1) || ISPTR(t1) ){ if( !ISARY(t2) && !ISPTR(t2) ) break; if( ISARY(t1) && ISARY(t2) && dimtab[d1] != dimtab[d2] ){ ! werror( "illegal array size combination" ); return; } if( ISARY(t1) ) ++d1; --- 799,805 ---- if( ISARY(t1) || ISPTR(t1) ){ if( !ISARY(t2) && !ISPTR(t2) ) break; if( ISARY(t1) && ISARY(t2) && dimtab[d1] != dimtab[d2] ){ ! werror("illegal array size combination" ); return; } if( ISARY(t1) ) ++d1; *************** *** 809,815 **** t1 = DECREF(t1); t2 = DECREF(t2); } ! werror( "illegal pointer combination" ); } } --- 809,815 ---- t1 = DECREF(t1); t2 = DECREF(t2); } ! werror("illegal pointer combination" ); } } *************** *** 918,924 **** size of the thing pointed to */ if( !ISPTR(p->in.type) ){ ! uerror( "pointer required"); return( SZINT ); } /* note: no pointers to fields */ --- 918,924 ---- size of the thing pointed to */ if( !ISPTR(p->in.type) ){ ! uerror("pointer required"); return( SZINT ); } /* note: no pointers to fields */ *************** *** 1003,1009 **** p, bpsize(p->in.left), INT, 0, INT ) ) ); } ! cerror( "illegal oconvert: %d", p->in.op ); return(p); } --- 1003,1009 ---- p, bpsize(p->in.left), INT, 0, INT ) ) ); } ! cerror("illegal oconvert: %d", p->in.op ); return(p); } *************** *** 1036,1047 **** case MINUS: { if( psize(p->in.left) != psize(p->in.right) ){ ! uerror( "illegal pointer subtraction"); } break; } case COLON: ! { if( t1 != t2 ) uerror( "illegal types in :"); break; } default: /* must work harder: relationals or comparisons */ --- 1036,1047 ---- case MINUS: { if( psize(p->in.left) != psize(p->in.right) ){ ! uerror("illegal pointer subtraction"); } break; } case COLON: ! { if( t1 != t2 ) uerror("illegal types in :"); break; } default: /* must work harder: relationals or comparisons */ *************** *** 1248,1259 **** int val; if( p->in.op != ICON ){ ! uerror( "constant expected"); val = 1; } else { val = p->tn.lval; ! if( val != p->tn.lval ) uerror( "constant too big for cross-compiler" ); } tfree( p ); return(val); --- 1248,1259 ---- int val; if( p->in.op != ICON ){ ! uerror("constant expected"); val = 1; } else { val = p->tn.lval; ! if( val != p->tn.lval ) uerror("constant too big for cross-compiler" ); } tfree( p ); return(val); *************** *** 1315,1321 **** !(o == CAST && (mt1 & MVOID)) ){ /* if lhs of RETURN is void, grammar will complain */ if( o != RETURN ) ! uerror( "value of void expression used" ); return( NCVT ); } mt1 &= ~MVOID; --- 1315,1321 ---- !(o == CAST && (mt1 & MVOID)) ){ /* if lhs of RETURN is void, grammar will complain */ if( o != RETURN ) ! uerror("value of void expression used" ); return( NCVT ); } mt1 &= ~MVOID; *************** *** 1455,1463 **** } if( mt12 == MSTR ) ! uerror( "%s is not a permitted struct/union operation", opst[o] ); else ! uerror( "operands of %s have incompatible types", opst[o] ); return( NCVT ); } --- 1455,1463 ---- } if( mt12 == MSTR ) ! uerror("%s is not a permitted struct/union operation", opst[o] ); else ! uerror("operands of %s have incompatible types", opst[o] ); return( NCVT ); } *************** *** 1465,1472 **** switch( ty ){ - case TVOID: - return( MPTR ); case UNDEF: return( MVOID ); case ENUMTY: --- 1465,1470 ---- *************** *** 1505,1511 **** i = tsize( p->in.type, p->fn.cdim, p->fn.csiz )/SZCHAR; tfree(p); ! if( i <= 0 ) werror( "sizeof returns 0" ); return( bcon( i ) ); } --- 1503,1509 ---- i = tsize( p->in.type, p->fn.cdim, p->fn.csiz )/SZCHAR; tfree(p); ! if( i <= 0 ) werror("sizeof returns 0" ); return( bcon( i ) ); } *************** *** 1557,1563 **** if( edebug ) fwalk( p, eprint, 0 ); # endif if( !reached ){ ! werror( "statement not reached" ); reached = 1; } p = optim(p); --- 1555,1561 ---- if( edebug ) fwalk( p, eprint, 0 ); # endif if( !reached ){ ! werror("statement not reached" ); reached = 1; } p = optim(p); *** /usr/src/usr.bin/lint/Makefile.old Wed Aug 14 05:27:43 1991 --- /usr/src/usr.bin/lint/Makefile Tue Jan 17 19:40:30 1995 *************** *** 1,32 **** # ! # @(#)Makefile 1.13 (Berkeley) 3/29/86 # M=/usr/src/lib/mip P=/usr/src/lib/pcc ! VPATH= $M XSTR= /usr/ucb/xstr # turn off the debugging to save string space ! CFLAGS=-O -I$M -I. -DBUG1 -DBUG2 -DBUG3 -DBUG4 LFLAGS=-i ! SRCS= $M/cgram.y $M/common.c $M/optim.c $M/pftn.c $M/scan.c $M/trees.c \ ! $M/xdefs.c lint.c hash.c $M/pass1.h $M/manifest.h macdefs.h \ lpass2.c .c.o: ! ${CC} -E ${CFLAGS} $*.c | ${XSTR} -c - ${CC} -c ${CFLAGS} x.c mv -f x.o $*.o ! rm -f x.c ! all: lpass1 lpass2 lpass1: cgram.o comm1.o optim.o pftn.o scan.o trees.o xdefs.o \ lint.o hash.o strings.o ${CC} ${LFLAGS} ${CFLAGS} cgram.o comm1.o optim.o pftn.o \ scan.o trees.o xdefs.o lint.o hash.o strings.o -o lpass1 ! cgram.o: $M/manifest.h $M/pass1.h pcclocal.h macdefs.h cgram.c strings.o: strings ${XSTR} --- 1,53 ---- # ! # @(#)Makefile 1.14 (2.11BSD GTE) 1/17/95 # M=/usr/src/lib/mip P=/usr/src/lib/pcc ! XSTR= /usr/ucb/xstr + MKSTR= /usr/ucb/mkstr # turn off the debugging to save string space ! STRINGS=\"/usr/lib/lint/lintstrings\" ! CFLAGS=-O -I$M -I. -DBUG1 -DBUG2 -DBUG3 -DBUG4 -DSTRINGFILE=${STRINGS} LFLAGS=-i ! ! SRCS= cgram.y common.c optim.c pftn.c scan.c trees.c \ ! xdefs.c lint.c hash.c pass1.h manifest.h macdefs.h \ lpass2.c .c.o: ! ${MKSTR} - lintstrings XX $*.c ! ${CC} -E ${CFLAGS} XX$*.c | ${XSTR} -c - ${CC} -c ${CFLAGS} x.c mv -f x.o $*.o ! rm -f x.c XX$*.c ! all: links lpass1 lpass2 + # Have to do this so that 'mkstr' can prepend a string to the filenames. + # If the VPATH capability is used the file names come out looking like + # "XX/usr/src/lib/mip/optim.c" which, obviously, does not work. + + links: + rm -f cgram.y common.c optim.c pftn.c scan.c trees.c pass1.h + rm -f manifest.h xdefs.c comm1.c + ln -s $M/cgram.y cgram.y + ln -s $M/common.c common.c + ln -s $M/optim.c optim.c + ln -s $M/pftn.c pftn.c + ln -s $M/scan.c scan.c + ln -s $M/trees.c trees.c + ln -s $M/xdefs.c xdefs.c + ln -s $M/pass1.h pass1.h + ln -s $M/manifest.h manifest.h + lpass1: cgram.o comm1.o optim.o pftn.o scan.o trees.o xdefs.o \ lint.o hash.o strings.o ${CC} ${LFLAGS} ${CFLAGS} cgram.o comm1.o optim.o pftn.o \ scan.o trees.o xdefs.o lint.o hash.o strings.o -o lpass1 ! cgram.o: manifest.h pass1.h pcclocal.h macdefs.h cgram.c strings.o: strings ${XSTR} *************** *** 34,59 **** mv -f xs.o strings.o rm -f xs.c ! comm1.o: $M/manifest.h $M/pass1.h pcclocal.h $M/common.c macdefs.h ! ln $M/common.c comm1.c ! ${CC} -E ${CFLAGS} -DPASS1COMMON comm1.c | ${XSTR} -c - ${CC} -c ${CFLAGS} -DPASS1COMMON x.c mv -f x.o comm1.o ! rm -f x.c ! rm -f comm1.c ! optim.o: $M/manifest.h macdefs.h $M/pass1.h pcclocal.h $M/optim.c ! pftn.o: $M/manifest.h macdefs.h $M/pass1.h pcclocal.h $M/pftn.c ! scan.o: $M/manifest.h macdefs.h $M/pass1.h pcclocal.h $M/scan.c ! trees.o: $M/manifest.h macdefs.h $M/pass1.h pcclocal.h $M/trees.c ! xdefs.o: $M/manifest.h $M/pass1.h pcclocal.h macdefs.h $M/xdefs.c ! cgram.c: $M/cgram.y pcctokens ! cat pcctokens $M/cgram.y > gram.in $(YACC) gram.in fgrep -v "static char yaccpar_sccsid" y.tab.c >cgram.c rm -f y.tab.c --- 55,81 ---- mv -f xs.o strings.o rm -f xs.c ! comm1.o: manifest.h pass1.h pcclocal.h common.c macdefs.h ! rm -f comm1.c ! ln common.c comm1.c ! ${MKSTR} - lintstrings XX comm1.c ! ${CC} -E ${CFLAGS} -DPASS1COMMON XXcomm1.c | ${XSTR} -c - ${CC} -c ${CFLAGS} -DPASS1COMMON x.c mv -f x.o comm1.o ! rm -f x.c comm1.c XXcomm1.c ! optim.o: manifest.h macdefs.h pass1.h pcclocal.h optim.c ! pftn.o: manifest.h macdefs.h pass1.h pcclocal.h pftn.c ! scan.o: manifest.h macdefs.h pass1.h pcclocal.h scan.c ! trees.o: manifest.h macdefs.h pass1.h pcclocal.h trees.c ! xdefs.o: manifest.h pass1.h pcclocal.h macdefs.h xdefs.c ! cgram.c: cgram.y pcctokens ! cat pcctokens cgram.y > gram.in $(YACC) gram.in fgrep -v "static char yaccpar_sccsid" y.tab.c >cgram.c rm -f y.tab.c *************** *** 68,79 **** rm -f pcctokens cat /usr/include/pcc.h $P/localdefs.h | $(GREP) '^#[ ]*define[ ][ ]*PCC_' | sed -e 's/^#[ ]*define[ ][ ]*PCC_/%term /' > pcctokens ! lint.o: $M/manifest.h macdefs.h $M/pass1.h lmanifest.h lpass2: lpass2.o hash.o ${CC} ${LFLAGS} ${CFLAGS} lpass2.o hash.o -o lpass2 ! lpass2.o: $M/manifest.h lmanifest.h pcclocal.h macdefs.h ${CC} ${CFLAGS} -c -I$M -I. lpass2.c hash.o: hash.c --- 90,101 ---- rm -f pcctokens cat /usr/include/pcc.h $P/localdefs.h | $(GREP) '^#[ ]*define[ ][ ]*PCC_' | sed -e 's/^#[ ]*define[ ][ ]*PCC_/%term /' > pcctokens ! lint.o: manifest.h macdefs.h pass1.h lmanifest.h lpass2: lpass2.o hash.o ${CC} ${LFLAGS} ${CFLAGS} lpass2.o hash.o -o lpass2 ! lpass2.o: manifest.h lmanifest.h pcclocal.h macdefs.h ${CC} ${CFLAGS} -c -I$M -I. lpass2.c hash.o: hash.c *************** *** 80,91 **** ${CC} ${CFLAGS} -c -I$M -I. hash.c lintall: ! lint -hpav -I. -I$M -DPASS1COMMON cgram.c $M/xdefs.c $M/scan.c \ ! $M/common.c $M/pftn.c $M/trees.c $M/optim.c hash.c lint.c install: all SHELL ! install -s lpass1 ${DESTDIR}/usr/lib/lint/lint1 ! install -s lpass2 ${DESTDIR}/usr/lib/lint/lint2 ./libs -rm -f ${DESTDIR}/usr/lib/lint/llib-ltermlib* ln -s llib-ltermcap ${DESTDIR}/usr/lib/lint/llib-ltermlib --- 102,114 ---- ${CC} ${CFLAGS} -c -I$M -I. hash.c lintall: ! lint -hpav -I. -I$M -DPASS1COMMON cgram.c xdefs.c scan.c \ ! common.c pftn.c trees.c optim.c hash.c lint.c install: all SHELL ! install -c -m 755 -s lpass1 ${DESTDIR}/usr/lib/lint/lint1 ! install -c -m 755 -s lpass2 ${DESTDIR}/usr/lib/lint/lint2 ! install -c -m 444 lintstrings ${DESTDIR}/usr/lib/lint/lintstrings ./libs -rm -f ${DESTDIR}/usr/lib/lint/llib-ltermlib* ln -s llib-ltermcap ${DESTDIR}/usr/lib/lint/llib-ltermlib *************** *** 92,102 **** ln -s llib-ltermcap.ln ${DESTDIR}/usr/lib/lint/llib-ltermlib.ln install -c SHELL ${DESTDIR}/usr/bin/lint ! shrink: ! rm -f *.o errs pcctokens pcclocal.h x.c xs.c strings ! ! clean: shrink ! rm -f lpass1 lpass2 cgram.c gram.in tags tags: ${SRCS} ctags -w ${SRCS} --- 115,125 ---- ln -s llib-ltermcap.ln ${DESTDIR}/usr/lib/lint/llib-ltermlib.ln install -c SHELL ${DESTDIR}/usr/bin/lint ! clean: ! rm -f *.o errs pcctokens pcclocal.h x.c xs.c strings lintstrings ! rm -f lpass1 lpass2 cgram.c gram.in tags yacc.* y.tab.c XX* ! rm -f cgram.y common.c optim.c pftn.c scan.c trees.c pass1.h ! rm -f manifest.h xdefs.c comm1.c tags: ${SRCS} ctags -w ${SRCS} *** /usr/src/usr.bin/lint/lint.c.old Sat Aug 17 16:43:52 1991 --- /usr/src/usr.bin/lint/lint.c Wed Jan 18 00:12:54 1995 *************** *** 1,5 **** #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)lint.c 1.10 (Berkeley) 3/20/86"; #endif lint # include "pass1.h" --- 1,5 ---- #if !defined(lint) && defined(DOSCCS) ! static char sccsid[] = "@(#)lint.c 1.10.1 (2.11BSD GTE) 1/17/95"; #endif lint # include "pass1.h" *************** *** 90,96 **** */ break; /* the compiler does this... */ } ! if( down == EFF && hflag ) werror( "null effect" ); } } --- 90,96 ---- */ break; /* the compiler does this... */ } ! if( down == EFF && hflag ) werror("null effect" ); } } *************** *** 117,125 **** if( !zflag && dimtab[p->sizoff+1] < 0 ){ /* never defined */ #ifndef FLEXNAMES ! if( hflag ) werror( "struct/union %.8s never defined", p->sname ); #else ! if( hflag ) werror( "struct/union %s never defined", p->sname ); #endif } } --- 117,125 ---- if( !zflag && dimtab[p->sizoff+1] < 0 ){ /* never defined */ #ifndef FLEXNAMES ! if( hflag ) werror("struct/union %.8s never defined", p->sname ); #else ! if( hflag ) werror("struct/union %s never defined", p->sname ); #endif } } *************** *** 131,139 **** k = lineno; lineno = p->suse; #ifndef FLEXNAMES ! uerror( "static variable %.8s unused", #else ! uerror( "static variable %s unused", #endif p->sname ); lineno = k; --- 131,139 ---- k = lineno; lineno = p->suse; #ifndef FLEXNAMES ! uerror("static variable %.8s unused", #else ! uerror("static variable %s unused", #endif p->sname ); lineno = k; *************** *** 169,175 **** if( (tt=BTYPE(t->aty))==STRTY || tt==UNIONTY ){ if( i<0 || i>= DIMTABSZ-3 ){ ! werror( "lint's little mind is blown" ); } else { j = (int)dimtab[i+3]; --- 169,175 ---- if( (tt=BTYPE(t->aty))==STRTY || tt==UNIONTY ){ if( i<0 || i>= DIMTABSZ-3 ){ ! werror("lint's little mind is blown" ); } else { j = (int)dimtab[i+3]; *************** *** 180,188 **** else { if( stab[j].suse <= 0 ) { #ifndef FLEXNAMES ! werror( "no line number for %.8s", #else ! werror( "no line number for %s", #endif stab[j].sname ); } --- 180,188 ---- else { if( stab[j].suse <= 0 ) { #ifndef FLEXNAMES ! werror("no line number for %.8s", #else ! werror("no line number for %s", #endif stab[j].sname ); } *************** *** 221,227 **** /* if variable number of arguments, only print the ones which will be checked */ if( vaflag > 0 ){ ! if( n < vaflag ) werror( "declare the VARARGS arguments you want checked!" ); else n = vaflag; } fsave( ftitle ); --- 221,227 ---- /* if variable number of arguments, only print the ones which will be checked */ if( vaflag > 0 ){ ! if( n < vaflag ) werror("declare the VARARGS arguments you want checked!" ); else n = vaflag; } fsave( ftitle ); *************** *** 351,361 **** case LT: case LE: if( p->in.left->in.type == CHAR && p->in.right->in.op==ICON && p->in.right->tn.lval < 0 ){ ! werror( "nonportable character comparison" ); } if( (p->in.op==EQ || p->in.op==NE ) && ISUNSIGNED(p->in.left->in.type) && p->in.right->in.op == ICON ){ if( p->in.right->tn.lval < 0 && p->in.right->tn.rval == NONAME && !ISUNSIGNED(p->in.right->in.type) ){ ! werror( "comparison of unsigned with negative constant" ); } } break; --- 351,361 ---- case LT: case LE: if( p->in.left->in.type == CHAR && p->in.right->in.op==ICON && p->in.right->tn.lval < 0 ){ ! werror("nonportable character comparison" ); } if( (p->in.op==EQ || p->in.op==NE ) && ISUNSIGNED(p->in.left->in.type) && p->in.right->in.op == ICON ){ if( p->in.right->tn.lval < 0 && p->in.right->tn.rval == NONAME && !ISUNSIGNED(p->in.right->in.type) ){ ! werror("comparison of unsigned with negative constant" ); } } break; *************** *** 363,375 **** case UGE: case ULT: if( p->in.right->in.op == ICON && p->in.right->tn.lval == 0 && p->in.right->tn.rval == NONAME ){ ! werror( "unsigned comparison with 0?" ); break; } case UGT: case ULE: if( p->in.right->in.op == ICON && p->in.right->tn.lval <= 0 && !ISUNSIGNED(p->in.right->in.type) && p->in.right->tn.rval == NONAME ){ ! werror( "degenerate unsigned comparison" ); } break; --- 363,375 ---- case UGE: case ULT: if( p->in.right->in.op == ICON && p->in.right->tn.lval == 0 && p->in.right->tn.rval == NONAME ){ ! werror("unsigned comparison with 0?" ); break; } case UGT: case ULE: if( p->in.right->in.op == ICON && p->in.right->tn.lval <= 0 && !ISUNSIGNED(p->in.right->in.type) && p->in.right->tn.rval == NONAME ){ ! werror("degenerate unsigned comparison" ); } break; *************** *** 448,456 **** if( q->sclass == AUTO || q->sclass == REGISTER ){ if( !ISARY(q->stype ) && !ISFTN(q->stype) && q->stype!=STRTY && q->stype!=UNIONTY ){ #ifndef FLEXNAMES ! werror( "%.8s may be used before set", q->sname ); #else ! werror( "%s may be used before set", q->sname ); #endif q->sflags |= SSET; } --- 448,456 ---- if( q->sclass == AUTO || q->sclass == REGISTER ){ if( !ISARY(q->stype ) && !ISFTN(q->stype) && q->stype!=STRTY && q->stype!=UNIONTY ){ #ifndef FLEXNAMES ! werror("%.8s may be used before set", q->sname ); #else ! werror("%s may be used before set", q->sname ); #endif q->sflags |= SSET; } *************** *** 513,521 **** else if( (npx->flgs|npy->flgs)== (VALSET|VALUSED) || (npx->flgs&npy->flgs&VALSET) ){ #ifndef FLEXNAMES ! if( flag ) werror( "%.8s evaluation order undefined", stab[npy->lid].sname ); #else ! if( flag ) werror( "%s evaluation order undefined", stab[npy->lid].sname ); #endif } if( npy->flgs == 0 ) npx->flgs = 0; --- 513,521 ---- else if( (npx->flgs|npy->flgs)== (VALSET|VALUSED) || (npx->flgs&npy->flgs&VALSET) ){ #ifndef FLEXNAMES ! if( flag ) werror("%.8s evaluation order undefined", stab[npy->lid].sname ); #else ! if( flag ) werror("%s evaluation order undefined", stab[npy->lid].sname ); #endif } if( npy->flgs == 0 ) npx->flgs = 0; *************** *** 549,557 **** } if( retstat == RETVAL+NRETVAL ) #ifndef FLEXNAMES ! werror( "function %.8s has return(e); and return;", cfp->sname); #else ! werror( "function %s has return(e); and return;", cfp->sname); #endif } --- 549,557 ---- } if( retstat == RETVAL+NRETVAL ) #ifndef FLEXNAMES ! werror("function %.8s has return(e); and return;", cfp->sname); #else ! werror("function %s has return(e); and return;", cfp->sname); #endif } *************** *** 562,570 **** if(p->suse>0 && !(p->sflags&(SMOS|STAG)) ){ if( p->sclass == PARAM ){ #ifndef FLEXNAMES ! if( vflag ) werror( "argument %.8s unused in function %.8s", #else ! if( vflag ) werror( "argument %s unused in function %s", #endif p->sname, cfs->sname ); --- 562,570 ---- if(p->suse>0 && !(p->sflags&(SMOS|STAG)) ){ if( p->sclass == PARAM ){ #ifndef FLEXNAMES ! if( vflag ) werror("argument %.8s unused in function %.8s", #else ! if( vflag ) werror("argument %s unused in function %s", #endif p->sname, cfs->sname ); *************** *** 571,579 **** } else { #ifndef FLEXNAMES ! if( p->sclass != TYPEDEF ) werror( "%.8s unused in function %.8s", #else ! if( p->sclass != TYPEDEF ) werror( "%s unused in function %s", #endif p->sname, cfs->sname ); } --- 571,579 ---- } else { #ifndef FLEXNAMES ! if( p->sclass != TYPEDEF ) werror("%.8s unused in function %.8s", #else ! if( p->sclass != TYPEDEF ) werror("%s unused in function %s", #endif p->sname, cfs->sname ); } *************** *** 583,591 **** !ISARY(p->stype) && !ISFTN(p->stype) ){ #ifndef FLEXNAMES ! werror( "%.8s set but not used in function %.8s", p->sname, cfs->sname ); #else ! werror( "%s set but not used in function %s", p->sname, cfs->sname ); #endif } --- 583,591 ---- !ISARY(p->stype) && !ISFTN(p->stype) ){ #ifndef FLEXNAMES ! werror("%.8s set but not used in function %.8s", p->sname, cfs->sname ); #else ! werror("%s set but not used in function %s", p->sname, cfs->sname ); #endif } *************** *** 592,600 **** if( p->stype == STRTY || p->stype == UNIONTY || p->stype == ENUMTY ){ if( !zflag && dimtab[p->sizoff+1] < 0 ) #ifndef FLEXNAMES ! werror( "structure %.8s never defined", p->sname ); #else ! werror( "structure %s never defined", p->sname ); #endif } --- 592,600 ---- if( p->stype == STRTY || p->stype == UNIONTY || p->stype == ENUMTY ){ if( !zflag && dimtab[p->sizoff+1] < 0 ) #ifndef FLEXNAMES ! werror("structure %.8s never defined", p->sname ); #else ! werror("structure %s never defined", p->sname ); #endif } *************** *** 621,635 **** andable( p ) NODE *p; { /* p is a NAME node; can it accept & ? */ register r; ! if( p->in.op != NAME ) cerror( "andable error" ); if( (r = p->tn.rval) < 0 ) return(1); /* labels are andable */ if( stab[r].sclass == AUTO || stab[r].sclass == PARAM ) return(0); #ifndef FLEXNAMES ! if( stab[r].sclass == REGISTER ) uerror( "can't take & of %.8s", stab[r].sname ); #else ! if( stab[r].sclass == REGISTER ) uerror( "can't take & of %s", stab[r].sname ); #endif return(1); } --- 621,635 ---- andable( p ) NODE *p; { /* p is a NAME node; can it accept & ? */ register r; ! if( p->in.op != NAME ) cerror("andable error" ); if( (r = p->tn.rval) < 0 ) return(1); /* labels are andable */ if( stab[r].sclass == AUTO || stab[r].sclass == PARAM ) return(0); #ifndef FLEXNAMES ! if( stab[r].sclass == REGISTER ) uerror("can't take & of %.8s", stab[r].sname ); #else ! if( stab[r].sclass == REGISTER ) uerror("can't take & of %s", stab[r].sname ); #endif return(1); } *************** *** 664,673 **** t = p->in.type; tl = p->in.left->in.type; if( aflag && (tl==LONG||tl==ULONG) && (t!=LONG&&t!=ULONG&&t!=UNDEF) ){ ! werror( "long assignment may lose accuracy" ); } if( aflag>=2 && (tl!=LONG&&tl!=ULONG) && (t==LONG||t==ULONG) && p->in.left->in.op != ICON ){ ! werror( "assignment to long may sign-extend incorrectly" ); } if( ISPTR(tl) && ISPTR(t) ){ tl = DECREF(tl); --- 664,673 ---- t = p->in.type; tl = p->in.left->in.type; if( aflag && (tl==LONG||tl==ULONG) && (t!=LONG&&t!=ULONG&&t!=UNDEF) ){ ! werror("long assignment may lose accuracy" ); } if( aflag>=2 && (tl!=LONG&&tl!=ULONG) && (t==LONG||t==ULONG) && p->in.left->in.op != ICON ){ ! werror("assignment to long may sign-extend incorrectly" ); } if( ISPTR(tl) && ISPTR(t) ){ tl = DECREF(tl); *************** *** 676,687 **** case 0: /* neither is a function pointer */ if( talign(t,p->fn.csiz) > talign(tl,p->in.left->fn.csiz) ){ ! if( hflag||pflag ) werror( "possible pointer alignment problem" ); } break; case 1: ! werror( "questionable conversion of function pointer" ); case 2: ; --- 676,687 ---- case 0: /* neither is a function pointer */ if( talign(t,p->fn.csiz) > talign(tl,p->in.left->fn.csiz) ){ ! if( hflag||pflag ) werror("possible pointer alignment problem" ); } break; case 1: ! werror("questionable conversion of function pointer" ); case 2: ; *************** *** 695,701 **** case PVCONV: case PMCONV: ! if( p->in.right->in.op != ICON ) cerror( "bad conversion"); p->in.op = FREE; return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) ); --- 695,701 ---- case PVCONV: case PMCONV: ! if( p->in.right->in.op != ICON ) cerror("bad conversion"); p->in.op = FREE; return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) ); *************** *** 707,716 **** break; s = p->in.right->tn.lval; if( s < 0 ) ! werror( "negative shift" ); else if( s >= dimtab[ p->fn.csiz ] ) ! werror( "shift greater than size of object" ); break; } --- 707,716 ---- break; s = p->in.right->tn.lval; if( s < 0 ) ! werror("negative shift" ); else if( s >= dimtab[ p->fn.csiz ] ) ! werror("shift greater than size of object" ); break; } *************** *** 738,744 **** if( p->in.left->in.op == ICON ) return; if( p->in.left->in.op == NAME && p->in.left->in.type == MOE ) return; } ! uerror( "illegal initialization" ); } char * --- 738,744 ---- if( p->in.left->in.op == ICON ) return; if( p->in.left->in.op == NAME && p->in.left->in.type == MOE ) return; } ! uerror("illegal initialization" ); } char * *************** *** 769,775 **** for( p=x; *s; ++s ){ if( *s != '"' ){ if( p >= &x[sizeof (x)] ) ! cerror( "filename too long" ); *p++ = *s; } } --- 769,775 ---- for( p=x; *s; ++s ){ if( *s != '"' ){ if( p >= &x[sizeof (x)] ) ! cerror("filename too long" ); *p++ = *s; } } *************** *** 818,826 **** fldal(t) unsigned t; { /* field alignment... */ if( t == ENUMTY ) return( ALCHAR ); /* this should be thought through better... */ if( ISPTR(t) ){ /* really for the benefit of honeywell (and someday IBM) */ ! if( pflag ) uerror( "nonportable field type" ); } ! else uerror( "illegal field type" ); return(ALINT); } --- 818,826 ---- fldal(t) unsigned t; { /* field alignment... */ if( t == ENUMTY ) return( ALCHAR ); /* this should be thought through better... */ if( ISPTR(t) ){ /* really for the benefit of honeywell (and someday IBM) */ ! if( pflag ) uerror("nonportable field type" ); } ! else uerror("illegal field type" ); return(ALINT); } *************** *** 884,890 **** continue; case 't': ! werror( "option %c now default: see `man 6 lint'", *p ); continue; case 'P': /* debugging, done in second pass */ --- 884,890 ---- continue; case 't': ! werror("option %c now default: see `man 6 lint'", *p ); continue; case 'P': /* debugging, done in second pass */ *************** *** 897,903 **** continue; default: ! uerror( "illegal option: %c", *p ); continue; } --- 897,903 ---- continue; default: ! uerror("illegal option: %c", *p ); continue; } *************** *** 967,973 **** case LONG: case ENUMTY: if( v>=0 && (v>>(s-1))==0 ) return; ! werror( "precision lost in assignment to (possibly sign-extended) field" ); default: return; --- 967,973 ---- case LONG: case ENUMTY: if( v>=0 && (v>>(s-1))==0 ) return; ! werror("precision lost in assignment to (possibly sign-extended) field" ); default: return; *************** *** 975,981 **** case UCHAR: case USHORT: case ULONG: ! if( v<0 || (v>>s)!=0 ) werror( "precision lost in field assignment" ); return; } --- 975,981 ---- case UCHAR: case USHORT: case ULONG: ! if( v<0 || (v>>s)!=0 ) werror("precision lost in field assignment" ); return; } *** /VERSION.old Fri Jan 13 20:25:17 1995 --- /VERSION Wed Jan 18 14:00:42 1995 *************** *** 1,4 **** ! Current Patch Level: 217 2.11 BSD ============ --- 1,4 ---- ! Current Patch Level: 218 2.11 BSD ============