Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought



LINT(1)         DOMAIN/IX Reference Manual (SYS5)         LINT(1)



NAME
     lint - a C program checker

USAGE
     lint [ options ] file ...

DESCRIPTION
     Lint attempts to detect features of the C program files that
     are likely to be erroneous, nonportable, or wasteful.  It
     also checks type usage more strictly than the compilers.
     Among the things that lint currently detects are unreachable
     statements, loops not entered at the top, automatic vari-
     ables declared and not used, and logical expressions whose
     value is constant.  Moreover, it checks the usage of func-
     tions to find functions that return values in some places
     and not in others, functions called with varying numbers or
     types of arguments, and functions whose values are not used
     or whose values are used but not returned.

     Arguments with names ending in .c are considered C source
     files.  Those with names ending in .ln are assumed to be the
     result of an earlier invocation of lint with either the -c
     or the -o option used.  The .ln files are analogous to .o
     (object) files produced by the cc (1) command when given a
     .c file as input.  Lint produces a warning message when it
     encounters files with other suffixes, but then it ignores
     these files.

     Lint takes all the .c,.ln, and llib-lx.ln (specified by -lx)
     files and processes them in their command line order.  By
     default, it appends the standard C lint library (llib-lc.ln)
     to the end of the list of files.  However, if the -p option
     is used, lint appends the portable C lint library (llib-
     port.ln) instead.  If the -c option is not used, the second
     pass of lint checks this list of files for mutual compati-
     bility.  When the -c option is used, the .ln and the llib-
     lx.ln files are ignored.

     You may specify any number of lint options in any order,
     intermixed with filename arguments.

     Lint produces its first output on a per-source-file basis.
     It collects and prints complaints regarding included files,
     after all source files have been processed.  If the -c
     option is not used, lint collects information gathered from
     all input files and checks it 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, it
     prints the source filename followed by a question mark.

     The behavior of the -c and the -o options allows for incre-
     mental use of lint on a set of C source files.  Generally,



Printed 6/10/85                                            LINT-1





LINT(1)         DOMAIN/IX Reference Manual (SYS5)         LINT(1)



     one invokes lint once for each source file with the -c
     option.  Each of these invocations produces a .ln file that
     corresponds to the .c file, and prints all messages about
     that source file only.  After all the source files have been
     separately run through lint, invoking it once more (without
     the -c option), lists all the .ln files with the needed -lx
     options.  This prints all the inter-file inconsistencies.
     This scheme works well with make (1), allowing make to
     detect only the source files that have been modified since
     the last time the set of source files were run through lint.

     Note that lint understands all DOMAIN cpp (1) directives,
     and that it now knows how to handle AEGIS standard system
     calls properly.

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

     -b        Suppress complaints about break statements that
               cannot be reached.  Programs produced by lex or
               yacc often result in many such complaints.

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

     -u        Suppress complaints about functions and external
               variables used and not defined, or defined and not
               used.  Suitable for running lint on a subset of
               files of a larger program.

     -v        Suppress complaints about unused arguments in
               functions.

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

     -lx       Include the additional lint library llib-lx.ln.
               For example, you can include a lint version of the
               math library llib-lm.ln by inserting -lm on the
               command line.  This argument does not suppress the
               default use of llib-lc.ln.  These lint libraries
               must be in the assumed directory.  This option can
               be used to reference local lint libraries and to
               develop multifile projects.

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

     -p        Attempt to check portability to other dialects
               (IBM and GCOS) of C.  Truncate all nonexternal
               names to eight characters, and all external names



LINT-2                                            Printed 6/10/85





LINT(1)         DOMAIN/IX Reference Manual (SYS5)         LINT(1)



               to six characters and one case.

     -c        Produce a .ln file for every .c file on the com-
               mand line.  These .ln files are the product of
               only the first pass of lint, and are not checked
               for interfunction compatibility.

     -o lib    Create a lint library with the name llib-llib.ln.
               The -c option nullifies any use of the -o option.
               The lint library produced is the input given to
               the second pass of lint.  The -o option simply
               causes this file to be saved in the named lint
               library.  To produce a llib-llib.ln without
               extraneous messages, use -x.  The -v option is
               useful if the source file(s) for the lint library
               are just external interfaces (e.g., the way the
               file llib-lc is written).  These option settings
               are also available by using certain conventional
               comments (see below).

     Lint also recognizes the -D, -U, and -I options of cpp (1)
     and the -g and -O options of cc (1) as separate arguments.
     Although it ultimately ignores the -g and -O options, its
     recognition of these brings lint's behavior closer to that
     of the cc command.

     The preprocessor symbol ``lint'' allows certain questionable
     code to be altered or removed for lint.

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

          /*NOTREACHED*/      At appropriate points, stop com-
                              ments about unreachable code.  Typ-
                              ically placed just after calls to
                              functions like exit (2).

          /*VARARGSn*/        Suppress the usual checking for
                              variable numbers of arguments in
                              the following function declaration.
                              Check the data types of the first n
                              arguments; interpret a missing n as
                              zero.

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

          /*LINTLIBRARY*/     At the beginning of a file, shut
                              off complaints about unused func-
                              tions and function arguments in
                              this file.  Equivalent to using the



Printed 6/10/85                                            LINT-3





LINT(1)         DOMAIN/IX Reference Manual (SYS5)         LINT(1)



                              -v and -x options.

CAUTIONS
     Lint does not understand functions that do not return, such
     as exit (2).

     In the case where an AEGIS system call written in Pascal is
     called from C, lint sometimes complains about Pascal ``out''
     variables that have not been initialized before use.

FILES
     /usr/lib               location of lint libraries specified
                            by the -lx option
     /usr/lib/lint[12]      first and second passes
     /usr/lib/llib-lc.ln    declarations for C library functions
                            (binary format; source is in
                            /usr/lib/llib-lc)
     /usr/lib/llib-port.ln  declarations for portable functions
                            (binary format; source is in
                            /usr/lib/llib-port)
     /usr/lib/llib-lm.ln    declarations for math library func-
                            tions (binary format; source is in
                            /usr/lib/llib-lm)
     /usr/tmp/*lint*        temporaries

     Note: All DOMAIN system calls have been added as declara-
     tions in the lint library /usr/lib/llib-lc.ln.  The system
     calls are found in the /sys/ins files.

RELATED INFORMATION
     cc (1), cpp (1), make (1).
























LINT-4                                            Printed 6/10/85



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