DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Analyzing your code with lint

Usage

You invoke lint with a command of the form

   $ lint file.c file.c
lint 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.c
That 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.ln
In 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.ln
the 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.c
directs 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


NOTE: For further information, see ``Searching for a header file'' in ``C and C++ compilation system''.

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.c
You 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.c
That command directs lint to
Next topic: lint libraries
Previous topic: Suspicious constructs

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004