1LINT(1) General Commands Manual LINT(1)
2
3
4
6 lint - a C program verifier
7
9 lint [ -abchnpuvx ] file ...
10
12 Lint attempts to detect features of the C program files which are
13 likely to be bugs, or non-portable, or wasteful. It also checks the
14 type usage of the program more strictly than the compilers. Among the
15 things which are currently found are unreachable statements, loops not
16 entered at the top, automatic variables declared and not used, and log‐
17 ical expressions whose value is constant. Moreover, the usage of func‐
18 tions is checked to find functions which return values in some places
19 and not in others, functions called with varying numbers of arguments,
20 and functions whose values are not used.
21
22 By default, it is assumed that all the files are to be loaded together;
23 they are checked for mutual compatibility. Function definitions for
24 certain libraries are available to lint; these libraries are referred
25 to by a conventional name, such as `-lm', in the style of ld(1).
26
27 Any number of the options in the following list may be used. The -D,
28 -U, and -I options of cc(1) are also recognized as separate arguments.
29
30 p Attempt to check portability to the IBM and GCOS dialects of C.
31
32 h Apply a number of heuristic tests to attempt to intuit bugs,
33 improve style, and reduce waste.
34
35 b Report break statements that cannot be reached. (This is not
36 the default because, unfortunately, most lex and many yacc out‐
37 puts produce dozens of such comments.)
38
39 v Suppress complaints about unused arguments in functions.
40
41 x Report variables referred to by extern declarations, but never
42 used.
43
44 a Report assignments of long values to int variables.
45
46 c Complain about casts which have questionable portability.
47
48 u Do not complain about functions and variables used and not
49 defined, or defined and not used (this is suitable for running
50 lint on a subset of files out of a larger program).
51
52 n Do not check compatibility against the standard library.
53
54 Exit(2) and other functions which do not return are not understood;
55 this causes various lies.
56
57 Certain conventional comments in the C source will change the behavior
58 of lint:
59
60 /*NOTREACHED*/
61 at appropriate points stops comments about unreachable code.
62
63 /*VARARGSn*/
64 suppresses the usual checking for variable numbers of arguments
65 in the following function declaration. The data types of the
66 first n arguments are checked; a missing n is taken to be 0.
67
68 /*NOSTRICT*/
69 shuts off strict type checking in the next expression.
70
71 /*ARGSUSED*/
72 turns on the -v option for the next function.
73
74 /*LINTLIBRARY*/
75 at the beginning of a file shuts off complaints about unused
76 functions in this file.
77
79 /usr/lib/lint[12] programs
80 /usr/lib/llib-lc declarations for standard functions
81 /usr/lib/llib-port declarations for portable functions
82
84 cc(1)
85 S. C. Johnson, Lint, a C Program Checker
86
87
88
89 LINT(1)