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