LINT(1) — UNIX 3.0
NAME
lint − a C program checker
SYNOPSIS
lint [ −abchnpuvx ] file ...
DESCRIPTION
Lint attempts to detect features of the C program files which are likely to be bugs, non-portable, or wasteful. It also checks type usage more strictly than the compilers. Among the things which are currently detected 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.
It is assumed that all the files are to be loaded together; they are checked for mutual compatibility. By default, lint uses function definitions from the standard lint library llib-lc.ln; function definitions from the portable lint library llib-port.ln are used when lint is invoked with the −p option.
Any number of lint options may be used, in any order. The following options are used to suppress certain kinds of complaints:
−a Suppress complaints about assignments of long values to variables that are not long.
−b Suppress complaints about break statements that cannot be reached. (Programs produced by lex or yacc will often result in a large number of such complaints.)
−c Suppress complaints about casts that have questionable portability.
−h Do not apply heuristic tests that attempt to intuit bugs, improve style, and reduce waste.
−u Suppress complaints about functions and external variables used and not defined, or defined and not used. (This option is suitable for running lint on a subset of files of a larger program.)
−v Suppress complaints about unused arguments in functions.
−x Do not report variables referred to by external declarations but never used.
The following arguments alter lint’s behavior:
−n Do not check compatibility against either the standard or the portable lint library.
−p Attempt to check portability to other dialects (IBM and GCOS) of C.
The −D, −U, and −I options of cc(1) are also recognized as separate arguments.
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.
/∗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.
Lint produces its first output on a per source file basis. Complaints regarding included files are collected and printed after all source files have been processed. Finally, information gathered from all input files is collected and checked for consistency. At this point, if it is not clear whether a complaint stems from a given source file or from one of its included files, the source file name will be printed followed by a question mark.
FILES
/usr/lib/lint[12] programs
/usr/lib/llib-lc.ln declarations for standard functions (binary format; source is in /usr/lib/llib-lc)
/usr/lib/llib-port.ln
declarations for portable functions (binary format; source is in /usr/lib/llib-port)
/usr/tmp/∗lint∗ temporaries
SEE ALSO
BUGS
Exit(2) and other functions which do not return are not understood; this causes various lies.
May 16, 1980