Commit | Line | Data |
---|---|---|
e3758c96 C |
1 | .TH LINT 1 |
2 | .UC 4 | |
3 | .SH NAME | |
4 | lint \- a C program verifier | |
5 | .SH SYNOPSIS | |
6 | .B lint | |
7 | [ | |
8 | .B \-abchnpuvx | |
9 | ] | |
10 | file ... | |
11 | .SH DESCRIPTION | |
12 | .I Lint | |
13 | attempts to detect features of the C program | |
14 | .I files | |
15 | which are | |
16 | likely to be bugs, or non-portable, or wasteful. | |
17 | It also checks the type usage of the program more strictly | |
18 | than the compilers. | |
19 | Among the things which are currently found are | |
20 | unreachable statements, | |
21 | loops not entered at the top, | |
22 | automatic variables declared and not used, | |
23 | and logical expressions whose value is constant. | |
24 | Moreover, the usage of functions is checked to find | |
25 | functions which return values in some places and not in others, | |
26 | functions called with varying numbers of arguments, | |
27 | and functions whose values are not used. | |
28 | .PP | |
29 | By default, it is assumed that all the | |
30 | .I files | |
31 | are to be loaded together; they are checked for | |
32 | mutual compatibility. | |
33 | Function definitions for certain libraries are available to | |
34 | .IR lint ; | |
35 | these libraries are referred to by a | |
36 | conventional name, | |
37 | such as `\-lm', in the style of | |
38 | .IR ld (1). | |
39 | .PP | |
40 | Any number of the options in the following list | |
41 | may be used. | |
42 | The | |
43 | .SM | |
44 | .BR \-D "\*S," | |
45 | .SM | |
46 | .BR \-U "\*S," | |
47 | and | |
48 | .SM | |
49 | .B \-I | |
50 | options of | |
51 | .IR cc (1) | |
52 | are also recognized as separate arguments. | |
53 | .TP | |
54 | .B p | |
55 | Attempt to check portability to the | |
56 | .I IBM | |
57 | and | |
58 | .I GCOS | |
59 | dialects of C. | |
60 | .TP | |
61 | .B h | |
62 | Apply a number of heuristic tests to attempt to | |
63 | intuit bugs, improve style, and reduce waste. | |
64 | .TP | |
65 | .B b | |
66 | Report | |
67 | .I break | |
68 | statements that cannot be reached. | |
69 | (This is not the default because, unfortunately, | |
70 | most | |
71 | .I lex | |
72 | and many | |
73 | .I yacc | |
74 | outputs produce dozens of such comments.) | |
75 | .TP | |
76 | .B v | |
77 | Suppress complaints about unused arguments in functions. | |
78 | .TP | |
79 | .B x | |
80 | Report variables referred to by extern declarations, | |
81 | but never used. | |
82 | .TP | |
83 | .B a | |
84 | Report assignments of long values to int variables. | |
85 | .TP | |
86 | .B c | |
87 | Complain about casts which have questionable portability. | |
88 | .TP | |
89 | .B u | |
90 | Do not complain about functions and variables used and not | |
91 | defined, or defined and not used (this is suitable for running | |
92 | .I lint | |
93 | on a subset of files out of a larger program). | |
94 | .TP | |
95 | .B n | |
96 | Do not check compatibility against the standard library. | |
97 | .PP | |
98 | .IR Exit (2) | |
99 | and other functions which do not return | |
100 | are not understood; this causes various lies. | |
101 | .PP | |
102 | Certain conventional comments in the C source | |
103 | will change the behavior of | |
104 | .IR lint : | |
105 | .TP | |
106 | /*NOTREACHED*/ | |
107 | at appropriate points | |
108 | stops comments about unreachable code. | |
109 | .TP | |
110 | .RI /*VARARGS n */ | |
111 | suppresses | |
112 | the usual checking for variable numbers of arguments | |
113 | in the following function declaration. | |
114 | The data types of the first | |
115 | .I n | |
116 | arguments are checked; | |
117 | a missing | |
118 | .I n | |
119 | is taken to be 0. | |
120 | .TP | |
121 | /*NOSTRICT*/ | |
122 | shuts off strict type checking in the next expression. | |
123 | .TP | |
124 | /*ARGSUSED*/ | |
125 | turns on the | |
126 | .B \-v | |
127 | option for the next function. | |
128 | .TP | |
129 | /*LINTLIBRARY*/ | |
130 | at the beginning of a file shuts off complaints about | |
131 | unused functions in this file. | |
132 | .SH FILES | |
133 | .ta \w'/usr/lib/llib-port 'u | |
134 | /usr/lib/lint/lint[12] programs | |
135 | .br | |
136 | /usr/lib/lint/llib-lc declarations for standard functions | |
137 | .br | |
138 | /usr/lib/lint/llib-port declarations for portable functions | |
139 | .SH SEE ALSO | |
140 | cc(1) | |
141 | .br | |
142 | S. C. Johnson, | |
143 | .I Lint, a C Program Checker | |
144 | .SH BUGS | |
145 | There are some things you just | |
146 | .B can't | |
147 | get lint to shut up about. |