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). Argu‐
26 ments ending in .ln are also treated as library files. To create lint
27 libraries, use the -C option:
28
29 lint -Cfoo files . . .
30
31 where files are the C sources of library foo. The result is a file
32 llib-lfoo.ln in the correct library format suitable for linting pro‐
33 grams using foo.
34
35 Any number of the options in the following list may be used. The -D,
36 -U, and -I options of cc(1) are also recognized as separate arguments.
37
38 p Attempt to check portability to the IBM and GCOS dialects of C.
39
40 h Apply a number of heuristic tests to attempt to intuit bugs,
41 improve style, and reduce waste.
42
43 b Report break statements that cannot be reached. (This is not
44 the default because, unfortunately, most lex and many yacc out‐
45 puts produce dozens of such comments.)
46
47 v Suppress complaints about unused arguments in functions.
48
49 x Report variables referred to by extern declarations, but never
50 used.
51
52 a Report assignments of long values to int variables.
53
54 c Complain about casts which have questionable portability.
55
56 u Do not complain about functions and variables used and not
57 defined, or defined and not used (this is suitable for running
58 lint on a subset of files out of a larger program).
59
60 n Do not check compatibility against the standard library.
61
62 z Do not complain about structures that are never defined (e.g.
63 using a structure pointer without knowing its contents.).
64
65 Exit(2) and other functions which do not return are not understood;
66 this causes various lies.
67
68 Certain conventional comments in the C source will change the behavior
69 of lint:
70
71 /*NOTREACHED*/
72 at appropriate points stops comments about unreachable code.
73
74 /*VARARGSn*/
75 suppresses the usual checking for variable numbers of arguments
76 in the following function declaration. The data types of the
77 first n arguments are checked; a missing n is taken to be 0.
78
79 /*NOSTRICT*/
80 shuts off strict type checking in the next expression.
81
82 /*ARGSUSED*/
83 turns on the -v option for the next function.
84
85 /*LINTLIBRARY*/
86 at the beginning of a file shuts off complaints about unused
87 functions in this file.
88
90 S.C. Johnson. Lint library construction implemented by Edward Wang.
91
93 /usr/libexec/lint/lint[12] programs
94 /usr/share/lint/llib-lc.ln declarations for standard functions
95 /usr/share/lint/llib-lc human readable version of above
96 /usr/share/lint/llib-port.ln declarations for portable functions
97 /usr/share/lint/llib-port human readable . . .
98 llib-l*.ln library created with -C
99
101 cc(1)
102 S. C. Johnson, Lint, a C Program Checker
103
105 There are some things you just can't get lint to shut up about.
106
107 /*NOSTRICT*/ is not implemented in the current version (alas).
108
109
110
1114th Berkeley Distribution October 22, 1996 LINT(1)