|
|
1.1 ! root 1: .TH LINT 1 "7 March 1983" ! 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: Arguments ending in ! 40: .I .ln ! 41: are also treated as library files. To create lint libraries, ! 42: use the ! 43: .B \-C ! 44: option: ! 45: .IP ! 46: lint \-Cfoo files . . . ! 47: .PP ! 48: where ! 49: .I files ! 50: are the C sources of library ! 51: .I foo. ! 52: The result is a file ! 53: .I llib-lfoo.ln ! 54: in the correct library format suitable for linting programs ! 55: using ! 56: .I foo. ! 57: .PP ! 58: Any number of the options in the following list ! 59: may be used. ! 60: The ! 61: .SM ! 62: .BR \-D "\*S," ! 63: .SM ! 64: .BR \-U "\*S," ! 65: and ! 66: .SM ! 67: .B \-I ! 68: options of ! 69: .IR cc (1) ! 70: are also recognized as separate arguments. ! 71: .TP ! 72: .B p ! 73: Attempt to check portability to the ! 74: .I IBM ! 75: and ! 76: .I GCOS ! 77: dialects of C. ! 78: .TP ! 79: .B h ! 80: Apply a number of heuristic tests to attempt to ! 81: intuit bugs, improve style, and reduce waste. ! 82: .TP ! 83: .B b ! 84: Report ! 85: .I break ! 86: statements that cannot be reached. ! 87: (This is not the default because, unfortunately, ! 88: most ! 89: .I lex ! 90: and many ! 91: .I yacc ! 92: outputs produce dozens of such comments.) ! 93: .TP ! 94: .B v ! 95: Suppress complaints about unused arguments in functions. ! 96: .TP ! 97: .B x ! 98: Report variables referred to by extern declarations, ! 99: but never used. ! 100: .TP ! 101: .B a ! 102: Report assignments of long values to int variables. ! 103: .TP ! 104: .B c ! 105: Complain about casts which have questionable portability. ! 106: .TP ! 107: .B u ! 108: Do not complain about functions and variables used and not ! 109: defined, or defined and not used (this is suitable for running ! 110: .I lint ! 111: on a subset of files out of a larger program). ! 112: .TP ! 113: .B n ! 114: Do not check compatibility against the standard library. ! 115: .TP ! 116: .B z ! 117: Do not complain about structures that are never defined (e.g. ! 118: using a structure pointer without knowing its contents.). ! 119: .PP ! 120: .IR Exit (2) ! 121: and other functions which do not return ! 122: are not understood; this causes various lies. ! 123: .PP ! 124: Certain conventional comments in the C source ! 125: will change the behavior of ! 126: .IR lint : ! 127: .TP ! 128: /*NOTREACHED*/ ! 129: at appropriate points ! 130: stops comments about unreachable code. ! 131: .TP ! 132: .RI /*VARARGS n */ ! 133: suppresses ! 134: the usual checking for variable numbers of arguments ! 135: in the following function declaration. ! 136: The data types of the first ! 137: .I n ! 138: arguments are checked; ! 139: a missing ! 140: .I n ! 141: is taken to be 0. ! 142: .TP ! 143: /*NOSTRICT*/ ! 144: shuts off strict type checking in the next expression. ! 145: .TP ! 146: /*ARGSUSED*/ ! 147: turns on the ! 148: .B \-v ! 149: option for the next function. ! 150: .TP ! 151: /*LINTLIBRARY*/ ! 152: at the beginning of a file shuts off complaints about ! 153: unused functions in this file. ! 154: .SH AUTHOR ! 155: S.C. Johnson. Lint library construction implemented by Edward Wang. ! 156: .SH FILES ! 157: .ta \w'/usr/lib/lint/llib-port.ln 'u ! 158: /usr/lib/lint/lint[12] programs ! 159: .br ! 160: /usr/lib/lint/llib-lc.ln declarations for standard functions ! 161: .br ! 162: /usr/lib/lint/llib-lc human readable version of above ! 163: .br ! 164: /usr/lib/lint/llib-port.ln declarations for portable functions ! 165: .br ! 166: /usr/lib/lint/llib-port human readable . . . ! 167: .br ! 168: llib-l*.ln library created with ! 169: .B \-C ! 170: .SH SEE ALSO ! 171: cc(1) ! 172: .br ! 173: S. C. Johnson, ! 174: .I Lint, a C Program Checker ! 175: .SH BUGS ! 176: There are some things you just ! 177: .B can't ! 178: get lint to shut up about.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.