|
|
1.1 ! root 1: .\" Copyright (c) 1980 Regents of the University of California. ! 2: .\" All rights reserved. The Berkeley software License Agreement ! 3: .\" specifies the terms and conditions for redistribution. ! 4: .\" ! 5: .\" @(#)lint.1 6.2 (Berkeley) 3/17/86 ! 6: .\" ! 7: .TH LINT 1 "March 17, 1986" ! 8: .UC 4 ! 9: .SH NAME ! 10: lint \- a C program verifier ! 11: .SH SYNOPSIS ! 12: .B lint ! 13: [ ! 14: .B \-abchnpuvx ! 15: ] ! 16: file ... ! 17: .SH DESCRIPTION ! 18: .I Lint ! 19: attempts to detect features of the C program ! 20: .I files ! 21: which are ! 22: likely to be bugs, or non-portable, or wasteful. ! 23: It also checks the type usage of the program more strictly ! 24: than the compilers. ! 25: Among the things which are currently found are ! 26: unreachable statements, ! 27: loops not entered at the top, ! 28: automatic variables declared and not used, ! 29: and logical expressions whose value is constant. ! 30: Moreover, the usage of functions is checked to find ! 31: functions which return values in some places and not in others, ! 32: functions called with varying numbers of arguments, ! 33: and functions whose values are not used. ! 34: .PP ! 35: By default, it is assumed that all the ! 36: .I files ! 37: are to be loaded together; they are checked for ! 38: mutual compatibility. ! 39: Function definitions for certain libraries are available to ! 40: .IR lint ; ! 41: these libraries are referred to by a ! 42: conventional name, ! 43: such as `\-lm', in the style of ! 44: .IR ld (1). ! 45: Arguments ending in ! 46: .I .ln ! 47: are also treated as library files. To create lint libraries, ! 48: use the ! 49: .B \-C ! 50: option: ! 51: .IP ! 52: lint \-Cfoo files . . . ! 53: .PP ! 54: where ! 55: .I files ! 56: are the C sources of library ! 57: .I foo. ! 58: The result is a file ! 59: .I llib-lfoo.ln ! 60: in the correct library format suitable for linting programs ! 61: using ! 62: .I foo. ! 63: .PP ! 64: Any number of the options in the following list ! 65: may be used. ! 66: The ! 67: .SM ! 68: .BR \-D "\*S," ! 69: .SM ! 70: .BR \-U "\*S," ! 71: and ! 72: .SM ! 73: .B \-I ! 74: options of ! 75: .IR cc (1) ! 76: are also recognized as separate arguments. ! 77: .TP ! 78: .B p ! 79: Attempt to check portability to the ! 80: .I IBM ! 81: and ! 82: .I GCOS ! 83: dialects of C. ! 84: .TP ! 85: .B h ! 86: Apply a number of heuristic tests to attempt to ! 87: intuit bugs, improve style, and reduce waste. ! 88: .TP ! 89: .B b ! 90: Report ! 91: .I break ! 92: statements that cannot be reached. ! 93: (This is not the default because, unfortunately, ! 94: most ! 95: .I lex ! 96: and many ! 97: .I yacc ! 98: outputs produce dozens of such comments.) ! 99: .TP ! 100: .B v ! 101: Suppress complaints about unused arguments in functions. ! 102: .TP ! 103: .B x ! 104: Report variables referred to by extern declarations, ! 105: but never used. ! 106: .TP ! 107: .B a ! 108: Report assignments of long values to int variables. ! 109: .TP ! 110: .B c ! 111: Complain about casts which have questionable portability. ! 112: .TP ! 113: .B u ! 114: Do not complain about functions and variables used and not ! 115: defined, or defined and not used (this is suitable for running ! 116: .I lint ! 117: on a subset of files out of a larger program). ! 118: .TP ! 119: .B n ! 120: Do not check compatibility against the standard library. ! 121: .TP ! 122: .B z ! 123: Do not complain about structures that are never defined (e.g. ! 124: using a structure pointer without knowing its contents.). ! 125: .PP ! 126: .IR Exit (2) ! 127: and other functions which do not return ! 128: are not understood; this causes various lies. ! 129: .PP ! 130: Certain conventional comments in the C source ! 131: will change the behavior of ! 132: .IR lint : ! 133: .TP ! 134: /*NOTREACHED*/ ! 135: at appropriate points ! 136: stops comments about unreachable code. ! 137: .TP ! 138: .RI /*VARARGS n */ ! 139: suppresses ! 140: the usual checking for variable numbers of arguments ! 141: in the following function declaration. ! 142: The data types of the first ! 143: .I n ! 144: arguments are checked; ! 145: a missing ! 146: .I n ! 147: is taken to be 0. ! 148: .TP ! 149: /*NOSTRICT*/ ! 150: shuts off strict type checking in the next expression. ! 151: .TP ! 152: /*ARGSUSED*/ ! 153: turns on the ! 154: .B \-v ! 155: option for the next function. ! 156: .TP ! 157: /*LINTLIBRARY*/ ! 158: at the beginning of a file shuts off complaints about ! 159: unused functions in this file. ! 160: .SH AUTHOR ! 161: S.C. Johnson. Lint library construction implemented by Edward Wang. ! 162: .SH FILES ! 163: .ta \w'/usr/lib/lint/llib-port.ln 'u ! 164: /usr/lib/lint/lint[12] programs ! 165: .br ! 166: /usr/lib/lint/llib-lc.ln declarations for standard functions ! 167: .br ! 168: /usr/lib/lint/llib-lc human readable version of above ! 169: .br ! 170: /usr/lib/lint/llib-port.ln declarations for portable functions ! 171: .br ! 172: /usr/lib/lint/llib-port human readable . . . ! 173: .br ! 174: llib-l*.ln library created with ! 175: .B \-C ! 176: .SH SEE ALSO ! 177: cc(1) ! 178: .br ! 179: S. C. Johnson, ! 180: .I Lint, a C Program Checker ! 181: .SH BUGS ! 182: There are some things you just ! 183: .B can't ! 184: get lint to shut up about. ! 185: .PP ! 186: /*NOSTRICT*/ ! 187: is not implemented in the current version (alas).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.