lint analyzer

lint libraries

You can use lint libraries to check your program for compatibility with the library functions you have called in it: the declaration of the function return type, the number and types of arguments the function expects, and so on. The standard lint libraries correspond to libraries supplied by the C compilation system, and generally are stored in the standard place on your system, the directory /usr/ccs/lib. By convention, lint libraries have names of the form llib-lx.ln.

The lint standard C libraries, llib-lgen and llib-crypt, are appended to the lint command line by default; checks for compatibility with it can be suppressed by invoking the -n option. Other lint libraries are accessed as arguments to -l.

   $ lint -lx file1.c file2.c
directs lint to check the usage of functions and variables in file1.c and file2.c for compatibility with the lint library llib-lx.ln. The library file, which consists only of definitions, is processed exactly as are ordinary source files and ordinary .ln files, except that functions and variables used inconsistently in the library file, or defined in the library file but not used in the source files, elicit no complaints.

To create your own lint library, insert the directive /* LINTLIBRARY */ at the head of a C source file, then invoke lint for that file with the -o option and the library name that will be given to -l:

   $ lint -ox files
   headed by /* LINTLIBRARY */
causes only definitions in the source files headed by /* LINTLIBRARY */ to be written to the file llib-lx.ln. (Note the analogy of lint -o to cc -o.) A library can be created from a file of function prototype declarations in the same way, except that both /* LINTLIBRARY */ and /* PROTOLIBn */ must be inserted at the head of the declarations file. If n is 1, prototype declarations will be written to a library .ln file just as are old-style definitions. If n is 0, the default, the process is cancelled. Invoking lint with -y is another way of creating a lint library:
   $ lint -y -ox file1.c file2.c
causes each source file named on the command line to be treated as if it began with /* LINTLIBRARY */ and only its definitions to be written to llib-lx.ln.

By default, lint searches for lint libraries in the standard place. To direct lint to search for a lint library in a directory other than the standard place, specify the path of the directory with the -L option:

   $ lint -Ldir -lx file1.c file2.c
The specified directory is searched before the standard place.
Next topic: lint filters
Previous topic: Using lint

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003