Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lint(1) — Ultrix WS 1.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(1)

lint(1)

NAME

lint − check C code

SYNTAX

lint [−abchnpuvxYz] file...

DESCRIPTION

The lint command attempts to detect features of the C program files which are likely to be bugs, or non-portable, or wasteful.  It also checks the type usage of the program more strictly than the compilers.  Among the things which are currently found are unreachable statements, loops not entered at the top, automatic variables declared and not used, and logical expressions whose value is constant.  Moreover, the usage of functions is checked to find functions which return values in some places and not in others, functions called with varying numbers of arguments, and functions whose values are not used. 

By default, it is assumed that all the files are to be loaded together; they are checked for mutual compatibility.  Function definitions for certain libraries are available to lint. These libraries are referred to by a conventional name, such as ‘−lm’, in the style of ld(.). Arguments ending in .ln are also treated as library files.

To create lint libraries, use the −C option:

lint −Cdlib files . . . 

where files are the C sources of library dlib. The result is a file llib-ldlib.ln in the correct library format suitable for linting programs using dlib. Note that if you have set the System V environment variable the System V lint library is used. For further information, see intro(.).

OPTIONS

Any number of the options in the following list may be used.  The −D, −U, and −I options of cc() are also recognized as separate arguments.

−aReport assignments of long values to int variables. 

−bReport break statements that cannot be reached.  (This is not the default because most lex and many yacc outputs produce dozens of such comments.)

−cComplain about casts that have questionable portability. 

−hApply a number of heuristic tests to attempt to find bugs, improve style, and reduce waste. 

−nDo not check compatibility against the standard library. 

−pAttempt to check portability to the IBM and GCOS dialects of C. 

−uDo not complain about functions and variables used and not defined, or defined and not used.  (This is suitable for running lint on a subset of files out of a larger program.)

−vSuppress complaints about unused arguments in functions. 

−xReport variables referred to be extern declarations, but never used. 

−Y
Use the System V version of the lint library.

−zDo not complain about structures that are never defined (for example, using a structure pointer without knowing its contents.) 

RESTRICTIONS

The exit() system calls and other functions that do not return are not understood; this causes various anomalies in lint output.

Certain conventional comments in the C source will change the behavior of lint:

/*NOTREACHED*/
At appropriate points stops comments about unreachable code.

/*VARARGSn*/
Suppresses the usual checking for variable numbers of arguments in the following function declaration. The data types of the first n arguments are checked; a missing n is taken to be 0. 

/*NOSTRICT*/
Shuts off strict type checking in the next expression.

/*ARGSUSED*/
Turns on the −v option for the next function. 

/*LINTLIBRARY*/
At the beginning of a file shuts off complaints about unused functions in this file.

FILES

/usr/lib/lint1Program
/usr/lib/lint2Program
/usr/lib/lint/llib-lc.lnDeclarations for standard functions
/usr/lib/lint/llib-lcHuman readable version of above
/usr/lib/lint/llib-lcV.lnSystem V declarations for standard functions /usr/lib/lint/llib-port.ln Declarations for portable functions
/usr/lib/lint/llib-portHuman readable . . . 
llib-l*.lnLibrary created with −C

SEE ALSO

cc(1) “Lint, a C Program Checker”, ULTRIX-32 Supplementary Documents, Vol. II:Programmer

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026