BSD 4_3 release
[unix-history] / usr / src / usr.bin / lint / lint.c
index 51e2b47..98af629 100644 (file)
@@ -1,10 +1,10 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)lint.c     1.5     (Berkeley)      3/30/83";
+static char sccsid[] = "@(#)lint.c     1.10    (Berkeley)      3/20/86";
 #endif lint
 
 #endif lint
 
-# include "mfile1"
+# include "pass1.h"
 
 
-# include "lmanifest"
+# include "lmanifest.h"
 
 # include <ctype.h>
 
 
 # include <ctype.h>
 
@@ -283,7 +283,7 @@ lpta( p ) NODE *p; {
        t.extra = (p->in.op==ICON);
        t.extra1 = 0;
 
        t.extra = (p->in.op==ICON);
        t.extra1 = 0;
 
-       if( !astype( &t, p->in.csiz ) ) {
+       if( !astype( &t, p->fn.csiz ) ) {
                switch( t.aty ){
 
                        case CHAR:
                switch( t.aty ){
 
                        case CHAR:
@@ -651,6 +651,7 @@ clocal(p) NODE *p; {
 
        register o;
        register unsigned t, tl;
 
        register o;
        register unsigned t, tl;
+       int s;
 
        switch( o = p->in.op ){
 
 
        switch( o = p->in.op ){
 
@@ -662,7 +663,7 @@ clocal(p) NODE *p; {
                /* assume conversion takes place; type is inherited */
                t = p->in.type;
                tl = p->in.left->in.type;
                /* assume conversion takes place; type is inherited */
                t = p->in.type;
                tl = p->in.left->in.type;
-               if( aflag && (tl==LONG||tl==ULONG) && (t!=LONG&&t!=ULONG) ){
+               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( "long assignment may lose accuracy" );
                        }
                if( aflag>=2 && (tl!=LONG&&tl!=ULONG) && (t==LONG||t==ULONG) && p->in.left->in.op != ICON ){
@@ -698,6 +699,20 @@ clocal(p) NODE *p; {
                p->in.op = FREE;
                return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) );
 
                p->in.op = FREE;
                return( buildtree( o==PMCONV?MUL:DIV, p->in.left, p->in.right ) );
 
+       case RS:
+       case LS:
+       case ASG RS:
+       case ASG LS:
+               if( p->in.right->in.op != ICON )
+                       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;
+
                }
 
        return(p);
                }
 
        return(p);
@@ -780,10 +795,11 @@ fsave( s ) char *s; {
        static union rec fsname;
        s = strip( s );
 #ifndef FLEXNAMES
        static union rec fsname;
        s = strip( s );
 #ifndef FLEXNAMES
-       if( strncmp( s, fsname.f.fn, LFNM ) ){
+       if( strncmp( s, fsname.f.fn, LFNM ) )
 #else
 #else
-       if (fsname.f.fn == NULL || strcmp(s, fsname.f.fn)) {
+       if (fsname.f.fn == NULL || strcmp(s, fsname.f.fn))
 #endif
 #endif
+               {
                /* new one */
 #ifndef FLEXNAMES
                strncpy( fsname.f.fn, s, LFNM );
                /* new one */
 #ifndef FLEXNAMES
                strncpy( fsname.f.fn, s, LFNM );
@@ -949,7 +965,7 @@ isitfloat ( s ) char *s; {
        /* lint version
        */
        dcon = atof( s );
        /* lint version
        */
        dcon = atof( s );
-       return( FCON );
+       return( DCON );
        }
 
 fldcon( p ) register NODE *p; {
        }
 
 fldcon( p ) register NODE *p; {