LINT(1)

NAME
lint, cyntax, cem - C program verifiers

SYNOPSIS
lint [ -abchnpuvx ] [ option ... ] file ...

cyntax [ option ... ] file ...

/usr/lib/cyntax/cem [ option ... ] file ...

DESCRIPTION
Lint checks, more thoroughly than cc(1), the syntactic validity and semantic consistency of one or more C program files. It is assumed that all the files are to be loaded together; they are checked for mutual compatibility. Function definitions for certain libraries are available to lint; these libraries are referred to by a conventional name, such as in the style of ld(1).

Any number of the option letters in the following list may be used. The -D, -U, and -I options of cc(1) are also recognized as separate arguments.

p   Attempt to check portability to some other dialects of C.
h   Apply heuristics to intuit bugs, improve style, and reduce waste.
b   Report break statements that cannot be reached.
v   Suppress complaints about unused arguments in functions.
x   Report variables referred to by extern declarations, but never used.
a   Report assignments of long values to int variables.
c   Complain about casts which have questionable portability.
u   Do not complain about functions and variables used and not defined, or defined and not used (this is suitable for running lint on a subset of files out of a larger program).
n   Do not check compatibility against the standard library.

Certain conventional comments in the C source will change the behavior of lint:

/*NOTREACHED*/
    at appropriate points. Stop comments about unreachable code.
/*VARARGSn*/
    Suppress the usual checking for variable numbers of arguments in the following function declaration. The data types of the first n arguments are checked; a missing n is taken to be 0.
/*PRINTFLIKEn*/
    The data types of the first n arguments are checked as usual. The remaining arguments are checked against the nth argument, which is interpreted as a printf(3) format string.
/*SCANFLIKEn*/
    Similarly for scanf(3).
/*NOSTRICT*/
    Shut off strict type checking in the next expression.
/*ARGSUSED*/
    Turn on the -v option for the next function.
/*LINTLIBRARY*/
    at the beginning of a file. Shut off complaints about unused functions in this file.

Cyntax makes checks similar to those of lint, more stringent about syntax, less observant of portability issues. It keeps type information gleaned from source files, whose names end with in `object files' with corresponding names ending in If all goes well it will cross check among all the and input files.

Options -D, -I, -U, -o, -l are as in cc(1), option -n is as in lint. Options -O, -P, -g, -p, and -s are ignored. Other options are:

-c  Suppress cross checking.
-d  Passed to cem.
-h  Base object files on the basename of the source file rather than the full pathname.
-G  Change default directory of include files to pass -lg to cem instead of -lc.
-j  Change default directory of include files to pass -lj to cem instead of -lc.
-k  Change default directory of include files to pass -lk to cem instead of -lc.
-w  Enable pedantic warning diagnostics.
-m  equivalent to
-v  Report what cyntax is actually doing.
-Vfunc:n
    Declare function func to have a variable number of arguments, the first n of which are to be type checked.

Cem (cemantics), the cross-checker, is normally invoked only by cyntax. It also has options, some of which cyntax can't be coerced into providing. Besides -o and -l, they are:

-m  Don't believe file modification times. These are normally used to avert redundant type checking.

-d  ``Debug'': print ascii version of files on standard output.

-p  Be pedantic about type checking.

-t  Unconditionally include file modification times in diagnostics.

-v  Use a verbose format for type names.

FILES

programs

declarations for standard functions

declarations for portable functions

cyntax proper

type library

SEE ALSO
cc(1),
    ld(1)
    S. C. Johnson `Lint, a C Program Checker', in Bell Laboratories, Unix Programmer's Manual, Holt, Rinehart and Winston, 1983, Vol. 2 (Seventh Edition)

BUGS
Exit(2) and other functions which do not return are not understood by lint; this causes various lies.
The unnatural default setting of lint option -b is intended to hide the ugliness of C code produced by yacc(1) and lex(1).