Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lint(1) — Ultrix WS 2.0 VAX

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 detects features of the C program files which are likely to be bugs, 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 as follows:

lint −Cdlib files . . .

The C sources of library dlib. are files.  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. 

−YenvironmentCompiles C programs for environment.  If environment is SYSTEM_FIVE or omitted, defines SYSTEM_FIVE for the preprocessor, cpp, and if the loader is invoked, specifies that the System V version of the C runtime library is used.  Also, if the math library is specified with the −lm option, the System V version is used.  If environment is POSIX, defines POSIX for the preprocessor.  If the environment variable PROG_ENV has the value SYSTEM_FIVE or POSIX, the effect is the same as specifying the corresponding −Yenvironment option to cc. The -Y option overrides the PROG_ENV variable; -YBSD can be used to override all special actions. 

−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 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/lint1
Program

/usr/lib/lint2
Program

/usr/lib/lint/llib-lc.ln
Declarations for standard functions

/usr/lib/lint/llib-lc
Human readable version of above

/usr/lib/lint/llib-lcV.ln
System V declarations for standard functions

/usr/lib/lint/llib-port.ln
Declarations for portable functions

/usr/lib/lint/llib-port
Human readable . . .

llib-l*.ln
Library 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