Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ lint(CP) — Xenix 2.3.4g

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cc(CP)



     LINT(CP)                 XENIX System V                  LINT(CP)



     Name
          lint - Checks C language usage and syntax.

     Syntax
          lint [-abchnpuvx] [-Idir] [-DUname] [-ollib] [-LARGE] file
          ...

     Description
          lint attempts to detect features of the C program file that
          are likely to be bugs, nonportable, or wasteful.  It also
          checks type usage more strictly than the C compiler.  Among
          the things which are currently detected are unreachable
          statements, loops not entered at the top, automatic
          variables declared and not used, and logical expressions
          whose value is constant.  Moreover, the usage of functions
          is checked to find functions which return values in some
          places and not in others, functions called with varying
          numbers of arguments, and functions whose values are not
          used.

          If more than one file is given, it is assumed that all the
          files are to be loaded together; they are checked for mutual
          compatibility.  If routines from the standard library are
          called from file, lint checks the function definitions using
          the standard lint library llibc.ln.  If lint is invoked with
          the -p option, it checks function definitions from the
          portable lint library llibport.ln.

          Any number of lint options may be used, in any order.  The
          following options are used to suppress certain kinds of
          complaints:

          -a   Suppresses complaints about assignments of long values
               to variables that are not long.

          -b   Suppresses complaints about break statements that
               cannot be reached.  (Programs produced by lex or yacc
               will often result in a large number of such
               complaints.)

          -c   Suppresses complaints about casts that have
               questionable portability.

          -h   Does not apply heuristic tests that attempt to intuit
               bugs, improve style, and reduce waste.

          -u   Suppresses complaints about functions and external
               variables used and not defined, or defined and not
               used.  (This option is suitable for running lint on a
               subset of files of a larger program.)

          -v   Suppresses complaints about unused arguments in



     Page 1                                           (printed 8/7/87)





     LINT(CP)                 XENIX System V                  LINT(CP)



               functions.

          -x   Does not report variables referred to by external
               declarations but never used.

          The following arguments alter lint's behavior:

          -LARGE
               Uses large model versions of the compiler and lint
               passes.  This enables lint to handle flexnames
               (identifiers greater than 8 characters in length).

          -n   Does not check compatibility against either the
               standard or the portable lint library.

          -o   Creates a hashed (i.e. faster) version of lint library
               lib with suffix ``.ln''.

          -p   Attempts to check portability to other dialects of C.

          -llibname
               Checks function definitions in the specified lint
               library.  For example, -lm causes the library llibm.ln
               to be checked.

          The -D, -U, and -I options of cc(CP) are also recognized as
          separate arguments.

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

               /*NOTREACHED*/
                    At appropriate points stops comments about
                    unreachable code.

               /*VARARGSn*/
                    Suppresses 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.

               /*ARGSUSED*/
                    Turns on the -v option for the next function.

               /*LINTLIBRARY*/
                    Shuts off complaints about unused functions in
                    this file.

          lint produces its first output on a per source file basis.
          Complaints regarding included files are collected and
          displayed after all source files have been processed.



     Page 2                                           (printed 8/7/87)





     LINT(CP)                 XENIX System V                  LINT(CP)



          Finally, information gathered from all input files is
          collected and checked for consistency.  At this point, if it
          is not clear whether a complaint stems from a given source
          file or from one of its included files, the source filename
          is displayed followed by a question mark.

     Files
          /usr/lib/lint[12]   Program files

          /usr/lib/llibc.ln, /usr/lib/llibport.ln, /usr/lib/llibm.ln,
          /usr/lib/llibdbm.ln, /usr/lib/llibtermlib.ln
          Standard lint libraries (binary format)

          /usr/lib/llibc, /usr/lib/llibport, /usr/lib/llibm, /usr/lib/llibdbm,
          /usr/lib/llibtermlib
          Standard lint libraries (source format)

          /usr/tmp/*lint*     Temporaries

     See Also
          cc(CP)

     Notes
          exit(S), and other functions which do not return, are not
          understood. This can cause improper error messages.






























     Page 3                                           (printed 8/7/87)



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026