Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

lint(1) [ultrix man page]

lint(1) 						      General Commands Manual							   lint(1)

       lint - a C program checker

       lint [ option ] ... file ...

       The command attempts to detect features of the C program files that are likely to be errors, nonportable, or wasteful.  It also checks type
       usage more strictly than the compilers.	Among the things that 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 locate functions that return values in some places, but not in others, functions called with varying numbers or types  of  argu-
       ments, and functions whose values are not used or whose values are used but none returned.

       Arguments  whose  names end with are interpreted as C source files.  Arguments whose names end with interpreted as the result of an earlier
       invocation of with either the -c or the -o option used.	The files are analogous to (object) files that are produced by	the  command  when
       given a file as input.  Files with other suffixes are warned about and ignored.

       The command takes all the and (specified by -lx) files and processes them in their command line order.  By default, the command appends the
       standard C library to the end of the list of files.  However, if the -p option is used, the portable C library is appended  instead.   When
       the  -c option is not used, the second pass of checks this list of files for mutual compatibility.  When the -c option is used, the and the
       files are ignored.

       Any number of options may be used, in any order, intermixed with filename arguments.  The following options are used  to  suppress  certain
       kinds of warning:

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

       -b   Suppress warnings about break statements that cannot be reached.  (Programs produced by or often result in such warnings).

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

       -u   Suppress warnings about functions and external variables used and not defined, or defined and not used.  (This option is suitable when
	    running 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.

       The following arguments alter the behavior of

       -lx  Include additional library For example, you can include a version of the Math Library by inserting -lm  on	the  command  line.   This
	    argument does not suppress the default use of
	    These  lint  libraries  must  be  in the assumed directory.  This option can be used to reference local libraries and is useful in the
	    development of multi-file projects.

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

       -p   Attempt to check portability to other dialects (IBM and GCOS) of C.  Along with stricter checking, this option causes all non-external
	    names to be truncated to eight characters and all external names to be truncated to six characters and one case.

       -c   Cause  to  produce	a file for every file on the command line. The files are the product of the command's first pass only, and are not
	    checked for inter-function compatibility.

       -o lib
	    Cause to create a lint library with the name The -c option nullifies any use of the -o option.  The library produced is the input that
	    is	given  to the second pass The -o option simply causes this file to be saved in the named library.  To produce a without extraneous
	    messages, use of the -x option is suggested.  The -v option is useful if the source files for the library are just external interfaces
	    (for  example, the way the file is written).  These option settings are also available through the use of comments which are described

       The -D, -U, and -I options of and the -g and -O options of are also recognized as separate arguments.  The -g and -O options  are  ignored,
       but,  by  recognizing  these  options,  the behavior of is closer to that of the command's second pass.	Other options are warned about and
       ignored.  The pre-processor symbol lint is defined to allow certain questionable code to be altered or removed for  Therefore,  the  symbol
       lint should be thought of as a reserved word for all code that is planned to be checked by

       The  command  produces  its first output on a per-source-file basis.  Warnings regarding included files are collected and printed after all
       source files have been processed.  Finally, if the -c option is not used, information gathered  from  all  input  files	is  collected  and
       checked	for  consistency.   At this point, if it is not clear whether a warning stems from a given source file or from one of its included
       files, the source file name is printed followed by a question mark.

       The behavior of the -c and the -o options allows for incremental use of on a set of C source files.  Generally, one invokes once  for  each
       source  file with the -c option.  Each of these invocations produces a file which corresponds to the file, and prints all messages that are
       about just that source file.  After all the source files have been separately run through it is invoked once more (without the -c  option),
       listing	all the files with the needed -lx options.  This prints all the inter-file inconsistencies.  This scheme works well with it allows
       to be used to only the source files that have been modified since the last time the set of source files were checked by

       The system call the function and other functions that do not return a value are not interpreted correctly by the command.

       Certain conventional comments in the C source change the behavior of

       /*NOTREACHED*/	 at appropriate points stops comments about unreachable code.  (This comment is typically placed just after calls to func-
			 tions like

       /*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*/	 at the beginning of a file shuts off complaints about unused functions and function arguments	in  this  file.   This	is
			 equivalent to using the -v and -x options.

			   the directory where the lint libraries specified by the -lx option must exist

			   first and second passes

			   declarations for C Library functions (binary format; source is in

			   System V declarations for standard functions

			   POSIX declarations for standard functions

			   declarations for portable functions (binary format; source is in

			   declarations for Math Library functions (binary format; source is in

       /usr/tmp/*lint*	   temporaries

See Also
       cc(1), cpp(1), make(1)

								       RISC								   lint(1)
Man Page