|
|
You invoke lint with a command of the form
$ lint file.c file.clint examines code in two passes. In the first, it checks for error conditions local to C source files, in the second for inconsistencies across them. This process is invisible to the user unless lint is invoked with -c:
$ lint -c file1.c file2.cThat command directs lint to execute the first pass only and collect information relevant to the second -- about inconsistencies in definition and use across file1.c and file2.c -- in intermediate files named file1.ln and file2.ln:
$ ls -1 file1.c file1.ln file2.c file2.lnIn this way, the -c option to lint is analogous to the -c option to cc, which suppresses the link editing phase of compilation. Generally speaking, lint's command line syntax closely follows cc's.
When the .ln files are linted
$ lint file1.ln file2.lnthe second pass is executed. lint processes any number of .c or .ln files in their command line order. So
$ lint file1.ln file2.ln file3.cdirects lint to check file3.c for errors internal to it and all three files for consistency.
lint searches directories for included header files in the same order as cc
Use the -I option to lint as you would the -I option to cc. If you want lint to check an included header file that is stored in a directory other than your current directory or the standard place, specify the path of the directory with -I as follows:
$ lint -Idir file1.c file2.cYou can specify -I more than once on the lint command line. Directories are searched in the order they appear on the command line. Of course, you can specify multiple options to lint on the same command line. Options may be concatenated unless one of the options takes an argument:
$ lint -cp -Idir -Idir file1.c file2.cThat command directs lint to