lint man page on OpenIndiana

Man page or keyword search:  
man Server   20441 pages
apropos Keyword Search (all sections)
Output format
OpenIndiana logo
[printable version]

lint(1)								       lint(1)

NAME
       lint - a C program checker

SYNOPSIS
       lint   [-#]   [-###]   [-a]   [-b]   [-Cfilename]   [-c]	 [-dirout=dir]
	      [-err=warn]  [-errchk=l]	[-errfmt=f]  [-errhdr=h]   [-erroff=t]
	      [-errsecurity=v]	  [-errtags=a]	  [-errwarn=t]	  [-F]	 [-fd]
	      [-flagsrc=file] [-h] [-Idir] [-k] [-Ldir] [-lx] [-m] [-m32|-m64]
	      [-Ncheck=c]  [-Nlevel=n] [-n] [-ox] [-p] [-Rfile] [-s] [-u] [-V]
	      [-v]  [-Wfile]  [-Xarch=amd64]  [-Xarch=v9]  [-Xalias_level[=l]]
	      [-XCC=a]	   [-Xc99[=o]]	   [-Xexplicitpar=a]	 [-Xkeeptmp=a]
	      [-Xtemp=dir]	       [-Xtime=a]	      [-Xtransition=a]
	      [-Xustr={ascii_utf16_ushort|no}] [-x] [-y] files

DESCRIPTION
       lint  detects  features of C program files which are likely to be bugs,
       non-portable, or wasteful.

       lint also checks type usage more	 strictly  than	 the  compiler.	  lint
       issues error and warning messages.  Among the things it detects are:
	 · Unreachable statements
	 · Loops not entered at the top
	 · Automatic variables declared and not used
	 · Logical expressions whose value is constant.

       lint  checks for 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
       none returned.

       lint can operate in two modes: basic, which is the default for the lint
       program,	 and  enhanced,	 which includes everything done by basic lint,
       plus provides additional, detailed analysis of code.

       In enhanced mode, the analysis includes:
	 · Structure and flow analysis of source program
	 · Constant propagations and constant expression evaluations
	 · Analysis of control flow and data flow
	 · Analysis of data types usages

       Thus, lint can detect the following problems in enhanced mode:
	 · Unused #include directives, variables, and procedures
	 · Memory usage after its deallocation
	 · Unused assignments
	 · Usage of a variable value before its initialization
	 · Deallocation of non-allocated memory
	 · Usage of pointers when writing in constant data segment
	 · Non-equivalent macro redefinitions
	 · Unreached code
	 · Nonconformity of the usages of value types in unions
	 · Implicit casts of actual arguments.

       The enhanced mode is enabled by the -Nlevel  or	-Ncheck	 options  (see
       descriptions below).

       Arguments whose names end with .c are taken to be C source files; argu‐
       ments ending in .i are taken to be preprocessor output files  (produced
       with the -P option to the compiler).

       Arguments  whose	 names	end  with .ln are taken to be the result of an
       earlier invocation of lint with either the -C, -c,  or  the  -o	option
       used.   The  .ln files are analogous to .o (object) files that are pro‐
       duced by the cc(1) command when given a .c file as input.   Files  with
       other suffixes are warned about and ignored.

       In enhanced mode, lint produces .ln files which store additional infor‐
       mation than .ln files produced in basic mode.  In enhanced  mode,  lint
       can  read  and  understand  all	.ln files generated by either basic or
       enhanced lint modes.  In basic mode, lint can read and  understand  .ln
       files generated only using basic lint mode.

       lint takes all the .c, .i, .ln, and llib-lx.ln (specified by -lx) files
       and processes them in  their  command-line  order.   By	default,  lint
       appends the standard C lint library (llib-lc.ln) to the end of the list
       of files.  When the -C or -c option is used, the .ln and the llib-lx.ln
       files  are  ignored.   When the -C or -c option is not used, the second
       pass of lint checks the .ln and the llib-lx.ln list of files for mutual
       compatibility.

       Any  number  of lint options may be used, in any order, intermixed with
       file-name arguments.  The lint options are:

       -#     Show each component as it is invoked (verbose mode).

       -###   Show each component as it is invoked, but, unlike the -# option,
	      do not actually execute.

       -a     Suppress	complaints  about  assignments of long values to vari‐
	      ables that are not long.

       -b     Suppress	complaints  about  break  statements  that  cannot  be
	      reached.

       -Cfilename
	      Produce  a  .ln  file with the file name specified by filename .
	      These .ln files are the  product	of  lint's  first  pass	 only.
	      filename can be a complete path name.

       -c     Cause  lint  to produce a .ln file for every .c file on the com‐
	      mand line.  These .ln files are the product of lint's first pass
	      only, and are not checked for inter-function compatibility.

       -dirout=dir
	      Set  a  directory	 name  where  all lint output files be will be
	      placed.  This option affects the -c option.

       -err=warn
	      This is a macro for -errwarn=%all.

       -errchk=l
	      Check structural arguments passed by value; Check portability to
	      environment  for which the size of long integers and pointers is
	      64 bits.

	      The values may be a comma separated list such  as	 -errchk=long‐
	      ptr64,structarg.

	      The  default  is -errchk=%none. Specifying -errchk is equivalent
	      to specifying -errchk=%all.

	      l is a comma-separated list of checks that consists  of  one  or
	      more of the following:

	      [no%]locfmtchk
		      Use  this option when you want lint to check printf-like
		      format strings during  its  first	 pass.	Regardless  of
		      whether  or  not	you use -errchk=locfmtchk, lint always
		      checks for printf-like  format  strings  in  its	second
		      pass.

	      [no%]parentheses
		      Use  this option to enhance the maintainability of code.
		      If -errchk=parentheses returns a warning, consider using
		      additional parentheses to clearly signify the precedence
		      of operations within the code.

	      [no%]signext
		      This option produces  error  messages  when  the	normal
		      ANSI/ISO C value-preserving rules allow the extension of
		      the sign of a signed-integral value in an expression  of
		      unsigned-integral	 type. This option only produces error
		      messages when you specify -errchk=longptr64 as well.

	      [no%]sizematch
		      Warn when a larger integer  is  assigned	to  a  smaller
		      integer.	These warnings will also be issued for assign‐
		      ment between same size integers which differ in  signed‐
		      ness; for example, unsigned int = signed int.

	      [no%]structarg
		      Check  structural	 arguments  passed by value and report
		      the cases when formal parameter type is not known.

	      [no%]longptr64
		      Check portability to environment for which the  size  of
		      long  integers  and  pointers is 64 bits and the size of
		      plain integers is 32 bits. Check assignments of  pointer
		      expressions  and long integer expressions to plain inte‐
		      gers, even when explicit cast is used.

	      %all    Perform all of errchk's checks.

	      %none   Perform none of errchk's checks. This is the default.

       -errfmt=f
	      Specify the format of lint output.  f can be one of the  follow‐
	      ing: macro, simple, src, or tab.

	      macro   Display  the source code, the line number, and the place
		      of the error, with macro unfolding.

	      simple  Display the line number and the place number, in	brack‐
		      ets, of the error, for one-line (simple) diagnostic mes‐
		      sages. Similar to the -s	option,	 but  includes	error-
		      position information.

	      src     Display  the source code, the line number, and the place
		      of the error (no macro unfolding).

	      tab     Display in tabular format.

	      The default is -errfmt = tab .  Specifying -errfmt is equivalent
	      to specifying -errfmt = tab.

	      If  more than one format is specified, the last format specified
	      is used, and lint warns about the unused formats.

       -errhdr=h
	      Enables the reporting of certain messages for header files  when
	      used with -Ncheck. h is a	 comma-separated list that consists of
	      one or more of the following: dir, no%dir, %all, %none, %user.

	      [no%]dir
		      Does [not] report the -Ncheck messages for header	 files
		      included from the directory dir.

	      %all    Check all used header files.

	      %none   Do not check header files. This is the default.

	      %user   Check  all  used	user header files, that is, all header
		      files except those in  /usr/include and its  subdirecto‐
		      ries, as well as those supplied by the compiler.

	      The  default  is -errhdr=%none. Specifying -errhdr is equivalent
	      to specifying -errhdr=%user.

       -erroff=t
	      Suppress or enable lint error messages. t is  a  comma-separated
	      list that consists of one or more of the following: tag, no%tag,
	      %all, %none.

	      [no%]tag
		      Suppress the message specified by this tag.

	      %all    Suppress all messages.

	      %none   Enable all messages. This is the default.

	      The default is -erroff=%none. Specifying -erroff	is  equivalent
	      to specifying -erroff=%all.

       -errsecurity=v
	      Use  the	-errsecurity  option  to  check your code for security
	      loopholes.  v must be one	 of  the  following:  core,  standard,
	      extended, or %none.

	      If  you  do not specify a setting for -errsecurity, lint sets it
	      to -errsecurity=%none. If you  specify  -errsecurity  without  a
	      flag, lint sets it to -errsecurity=standard.

	      core     This  level  checks for source code constructs that are
		       almost always either unsafe  or	difficult  to  verify.
		       Checks at this level include:

		       o  Use of variable format strings with the printf() and
		       scanf() family of functions

		       o Use of unbounded string (%s) formats in scanf() func‐
		       tions

		       o   Use	of  functions  with  no	 safe  usage:  gets(),
		       cftime(), ascftime(), creat()

		       o Incorrect use of open() with O_CREAT

		       Consider source code that  produces  warnings  at  this
		       level  to  be a bug. The source code in question should
		       be changed. In all cases, straightforward safer	alter‐
		       natives are available.

	      standard This level includes all checks from the core level plus
		       checks for constructs that may be safe, but have better
		       alternatives  available.	 This level is well suited for
		       newly-written code. Additional  checks  at  this	 level
		       include:

		       o Use of string copy functions other than strlcpy()

		       o Use of weak random number functions

		       o Use of unsafe functions to generate temporary files

		       o Use of fopen() to create files

		       o Use of functions that invoke the shell

		       Replace	source	code  that  produces  warnings at this
		       level with new or significantly modified code.  Balance
		       addressing  these  warnings  in legacy code against the
		       risks of destabilizing the application.

	      extended This level contains the most complete  set  of  checks,
		       including everything from the core and standard levels.
		       In addition, a number of warnings are  generated	 about
		       constructs  that may be unsafe in some situations.  The
		       checks at this level are useful as an aid in  reviewing
		       code,  but  need	 not  be used as a standard with which
		       acceptable source code must comply.  Additional	checks
		       at this level include:

		       o Calls to getc() or fgetc() inside a loop

		       o Use of functions prone to pathname race conditions

		       o Use of the exec() family of functions

		       o Race conditions between stat() and other functions

		       Review  source  code  which  produces  warnings at this
		       level to determine if the potential security  issue  is
		       present.

       -errtags=a
	      Displays the message tag for each error message. a can be either
	      yes or no.  The default is -errtags=no. Specifying -errtags   is
	      equivalent to -errtags=yes.

	      Works with all -errfmt  options.

       -errwarn=t
	      If  the  indicated  warning message is issued, lint exits with a
	      failure status. t is a comma-separated list that consists of one
	      or more of the following:

	      tag      Cause  lint  to exit with a fatal status if the message
		       specified by tag is issued as a warning message. Has no
		       effect if tag is not issued.

	      no%tag   Prevent	lint  from  exiting with a fatal status if the
		       message specified by tag is issued only	as  a  warning
		       message.	 Has no effect if tag is not issued.  Use this
		       option to revert a warning message that was  previously
		       specified  by this option with tag or %all from causing
		       lint to exit with a fatal status when issued as a warn‐
		       ing message.

	      %all     Cause  lint  to exit with a fatal status if any warning
		       messages are issued. %all can be followed by no%tag  to
		       exempt specific warning messages from this behavior.

	      %none    Prevents any warning messages from causing lint to exit
		       with a fatal status should any warning tag  be  issued.
		       This is the default.

       -F     Print  path  names of files.  lint normally prints the file name
	      without the path.

       -fd    Report about old-style function definitions and declarations.

       -flagsrc=file
	      Execute lint with options contained in the file  file.  Multiple
	      options can be specified in file, one per line.

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

       -Idir  Search for included header files in  the	directory  dir	before
	      searching the current directory and/or the standard place.

       -k     Alter   the  behavior  of	 /∗LINTED  [message]∗/	directives  or
	      NOTE(LINTED(message))  annotations.  Normally,  lint  suppresses
	      warning  messages	 for  the  code	 following  these  directives.
	      Instead of suppressing the messages, lint prints	an  additional
	      message  containing  the comment inside the directive or annota‐
	      tion.

       -Ldir  Search for lint libraries in dir before searching	 the  standard
	      place.

       -lx    Include  the  lint  library  llib-lx.ln.	 For  example, you can
	      include a lint version of the math library llib-lm.ln by insert‐
	      ing  -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 is useful in the development of	multi-
	      file projects.

       -m     Suppress	 complaints  about  external  symbols  that  could  be
	      declared static.

       -m32|-m64
	      Specifies the memory model for the program being analyzed.  Also
	      searches for lint libraries that correspond to the selected mem‐
	      ory model (32-bit/64-bit).

	      Use -m32 to verify 32-bit C programs and -m64 to verify 64-bit C
	      programs.

	      The ILP32 memory model (32-bit int, long, pointer data types) is
	      the default on all Solaris platforms and on Linux platforms that
	      are  not	64-bit	enabled.  The  LP64 memory model (64-bit long,
	      pointer data types) is the default on Linux platforms  that  are
	      64-bit  enabled.	-m64  is  permitted only on platforms that are
	      enabled for the LP64 model.

	      Note that in previous compiler releases, the memory model, ILP32
	      or  LP64, was implied by the choice of the -Xarch flag. Starting
	      with the Sun Studio 12 compilers, this is no longer the case. On
	      most  platforms,	just adding -m64 to the command line is suffi‐
	      cient for linting 64-bit programs.

	      See the sections following this list of lint  options  for  more
	      information on the predefined macroes.  See also -Xarch.

       -Ncheck=c
	      Check header files for corresponding declarations; check macros.
	      c is a comma-separated list of checks that consists  of  one  or
	      more of the following:

	      macro   Check for consistency of macro definitions across files.

	      extern  Check  for  one-to-one  correspondence  of  declarations
		      between source files and their associated	 header	 files
		      (for  example,  for  file1.c  and file1.h).  Ensure that
		      there are neither extraneous nor missing extern declara‐
		      tions in a header file.

	      %all    Perform all of Ncheck's checks.

	      %none   Perform none of Ncheck's checks.	This is the default.

	      no%macro
		      Perform none of Ncheck's macro checks.

	      no%extern
		      Perform none of Ncheck's extern checks.

	      The   values  may	 be  combined  with  a	comma,	for   example,
	      -Ncheck=extern,macro.

	      The default is -Ncheck=%none.  Specifying -Ncheck is  equivalent
	      to specifying -Ncheck=%all.

       -Nlevel=n
	      Turns  on enhanced lint mode by specifying the level of enhanced
	      lint analysis for reporting problems. This option allows you  to
	      control the amount of detected errors. The higher the level, the
	      longer the verification time. n is a number:  1,	2,  3,	or  4.
	      There  is	 no  default. If you do not specify -Nlevel, lint uses
	      its basic analysis mode.	If  you	 specify  -Nlevel  without  an
	      argument, lint sets -Nlevel=4.

	      See  the beginning of this man page or the C User's Guide for an
	      explanation of the basic and enhanced lint analysis modes.

	      -Nlevel=1 Analyze single procedures. Report unconditional errors
	      that  occur  on some program execution paths. Does not do global
	      data and control flow analysis.

	      -Nlevel=2 The default.  Analyze  the  whole  program,  including
	      global  data  and control flow. Report unconditional errors that
	      occur on some program execution paths.

	      -Nlevel=3 Analyze the whole program, including constant propaga‐
	      tion, cases when constants are used as actual arguments, as well
	      as the analysis performed under -Nlevel=2.

	      Verification of a C program at this analysis level takes two  to
	      four times longer then at the preceding level. The extra time is
	      required because lint assumes partial interpretation of the pro‐
	      gram  by creating sets of possible values for program variables.
	      These sets of variables are created on the  basis	 of  constants
	      and conditional statements that contain constant operands avail‐
	      able in the program. The sets form the basis for creating	 other
	      sets  (a	form  of  constant propagation).  Sets received as the
	      result of the analysis are evaluated for	correctness  according
	      to the following algorithm:

	      If  a  correct  value  exists  among  all	 possible values of an
	      object, then that correct value is used as the basis for further
	      propagation; otherwise an error is diagnosed.

	      -Nlevel=4	 Analyze  the  whole  program,	and report conditional
	      errors that could occur when certain program execution paths are
	      used, as well as the analysis performed under -Nlevel=3.

	      At  this	level,	there  are additional diagnostic messages. The
	      analysis algorithm generally corresponds to the  analysis	 algo‐
	      rithm  of	 -Nlevel=3  with the exception that any invalid values
	      now generate an error message. The amount of time	 required  for
	      analysis at this level can increase as much as two orders (about
	      20 to 100 times more slowly).  In	 this  case,  the  extra  time
	      required	is  directly proportional to the program complexity as
	      characterised by recursion, conditional  statements  etc.	 As  a
	      result  of this, it may be difficult to use this level of analy‐
	      sis for a program that exceeds 100,000 lines.

       -n     Do not check compatibility against the standard C lint library.

       -ox    Cause lint to create a lint library with	the  name  llib-lx.ln.
	      This library is created from all the .ln files that lint used in
	      its second pass. The -c option  nullifies	 any  use  of  the  -o
	      option.	To  produce  a llib-lx.ln without extraneous messages,
	      you can use the -x option. The -v option is useful if the source
	      file(s)  for  the lint library are just external interfaces. The
	      lint library produced can be used later if lint is invoked  with
	      the -lx option.

	      By  default, you create libraries in lint's basic format. If you
	      use lint's  enhanced  mode,  the	library	 created  will	be  in
	      enhanced format, and can only be used in enhanced mode.

       -p     Attempt to check portability to other dialects 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.

       -Rfile Write a .ln file to file, for use by cxref(1).  This option dis‐
	      ables the enhanced mode, if it is switched on.

       -s     Produce simple diagnostics with "warning:" or "error:" prefixes.
	      By default lint buffers some messages to produce	compound  out‐
	      put.

       -u     Suppress	complaints about functions and external variables used
	      and not defined, or defined and not used.	 This option is	 suit‐
	      able for running lint on a subset of files of a larger program.

       -V     Write to standard error the product name and release.

       -v     Suppress complaints about unused arguments in functions.

       -Wfile Write a .ln file to file, for use by cflow(1).  This option dis‐
	      ables the enhanced mode, if it is switched on.

       -Xalias_level[=l]
	      where l is one of any, basic,  weak,  layout,  strict,  std,  or
	      strong.  See the C User's Guide for more information.

	      If  you do not specify -Xalias_level, the default of the flag is
	      -Xalias_level=any. This means that there is no type-based alias-
	      analysis.	 If  you  specify  -Xalias_level  but  do not supply a
	      level, the default is -Xalias_level=layout.

	      Be sure to run lint at a level of disambiguation that is no more
	      strict  than the level at which you ran the compiler. If you run
	      lint at a level of disambiguation that is more strict  than  the
	      level  at	 which	you compiled, the results will be difficult to
	      interpret and possibly misleading.

       -Xarch=amd64
	      (Solaris	Operating  System)  Deprecated.	 Do   not   use.   See
	      -m32|-m64.

       -Xarch=v9
	      (Solaris	 Operating   System)   Deprecated.  Do	not  use.  See
	      -m32|-m64.

       -XCC=a Accept C++-style comments. a can be either yes or no.   In  par‐
	      ticular,	/  can be used to indicate the start of a comment. The
	      default is -XCC=no; specifying -XCC is equivalent to  specifying
	      -XCC=yes.

	      Note:
	      You  only	 need to use this option if you use -xc99=%none. Under
	      -xc99=%all (the default), lint accepts comments which are	 indi‐
	      cated by //.

       -Xc99=o
	      The  -Xc99 flag controls compiler recognition of the implemented
	      features from the C99 standard (ISO/IEC  9899:1999,  Programming
	      Language - C).

	      o can be one of the following: all, none.

	      -Xc99=none  turns	 off  recognition  of  C99 features. -Xc99=all
	      turns on recognition of supported C99 features. Specifying -Xc99
	      without any arguments is the same as -Xc99=all.

	      Note:
	      Though  the compiler support-level defaults to the language fea‐
	      tures of the C99 standard,  the  standard	 headers  provided  by
	      Solaris(TM)  8 and Solaris 9 software in /usr/include do not yet
	      conform with the 1999 ISO/IEC C standard. If you encounter error
	      messages,	 try  using  -Xc99=none	 to  obtain the 1990 ISO/IEC C
	      standard behavior for these headers.

       -Xexplicitpar=a
	      (SPARC) Directs lint to recognize #pragma MP directives.	a  can
	      be either yes or no. The default is -Xexplicitpar=no; specifying
	      -Xexplicitpar is equivalent to specifying -Xexplicitpar=yes.

       -Xkeeptmp=a
	      Keep temporary files created during linting instead of  deleting
	      them  automatically.  a  can be either yes or no. The default is
	      -Xkeeptmp=no; specifying -Xkeeptmp is equivalent	to  specifying
	      -Xkeeptmp=yes.

       -Xtemp=dir
	      Set  the	directory  for	temporary  files  to dir. Without this
	      option, temporary files go into /tmp.

       -Xtime=a
	      Report the execution time for each lint pass. a  can  be	either
	      yes or no. The default is -Xtime=no; specifying -Xtime is equiv‐
	      alent to specifying -Xtime=yes.

       -Xtransition=a
	      Issue warnings for the differences between K&R C and Sun ANSI C.
	      a	 can  be  either  yes  or no.  The default is -Xtransition=no;
	      specifying -Xtransition is equivalent  to	 specifying  -Xtransi‐
	      tion=yes.

       -Xustr={ascii_utf16_ushort|no}
	      This  option  enables recognition of string literals of the form
	      U"ASCII_string" as an array of unsigned short  int.  Since  such
	      strings  are  not	 yet part of any standard, this option enables
	      recognition of non-standard C.

	      You can turn off lint recognition of U"ASCII_string" string lit‐
	      erals  by	 specifying  -Xustr=no. The rightmost instance of this
	      option on the command line overrides all previous instances.

	      The default is -Xustr=no. If you specify -Xustr without an argu‐
	      ment, the compiler won't accept it and instead issues a warning.
	      The default can change if the C or C++ standards define a	 mean‐
	      ing for the syntax.

	      You can specify -Xustr=ascii_ustf16_ushort without also specify‐
	      ing a U"ASCII_string" string literal. It is not an error	to  do
	      so.

	      See  the explanation for -xustr in the cc(1) man page for a code
	      example that shows a string prepended by U.

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

       -y     Specify  that  the  file	being  linted  be  treated  as	if the
	      /∗LINTLIBRARY∗/ directive or  the	 NOTE(LINTLIBRARY)  annotation
	      had  been used.  A lint library is normally created by using the
	      /∗LINTLIBRARY∗/ directive or the NOTE(LINTLIBRARY) annotation.

       lint recognizes many cc (1) command-line options, including    -A,  -D,
       -E, -g,	-H,  -O, -P, -U, -Xa, -Xc, -Xs, -Xt , and -Y , although -g and
       -O are ignored.	Unrecognized options are  warned  about	 and  ignored.
       The predefined macro lint is defined to allow certain questionable code
       to be altered or removed for lint.  Thus, the  symbol  lint  should  be
       thought	of  as	a  reserved  word  for	all code that is planned to be
       checked by lint.

       lint provides the following predefinition  predicate  by	 default  (not
       valid in -Xc mode):
		 #assert lint (on)

       Predefinitions, not valid in -Xc mode:
		 sun
		 lint
		 unix
		 sparc (SPARC only)
		 i386 (x86 only)

       These predefinitions are valid in all modes:
		 __BUILTIN_VA_ARG_INCR
		 __SUNPRO_C=0x590
		 __SVR4(SPARC)
		 __SunOS(Solaris)
		 __SunOS_OSN.N(Solaris)
		 __amd64(x86	with-m64)
		 __gnu__linux(linux)
		 __i386(x86)
		 __linux(linux)
		 __linux__(linux)
		 __sparc(SPARC)
		 __sparcv9(with-m64)
		 __sun(Solaris)
		 __unix
		 __`uname -s`_`uname -r`
		 __x86_64(x86)
		 linux(x86,linux)

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

	      /∗ARGSUSEDn∗/
		     makes lint check only the first n arguments for usage;  a
		     missing  n is taken to be 0 (this directive acts like the
		     -v option for the next function).

	      /∗CONSTCOND∗/ or /∗CONSTANTCONDITION∗/
		     suppresses complaints about  constant  operands  for  the
		     conditional expression.

	      /∗EMPTY∗/
		     suppresses	 complaints  about a null statement consequent
		     on an if statement.   This	 directive  should  be	placed
		     after  the	 test  expression,  and	 before the semicolon.
		     This directive is supplied to support empty if statements
		     when  a valid else statement follows.  It suppresses mes‐
		     sages on an empty else consequent.

	      /∗FALLTHRU∗/ or /∗FALLTHROUGH∗/
		     suppresses complaints about fall through  to  a  case  or
		     default  labelled	statement.   This  directive should be
		     placed immediately preceding the label.

	      /∗LINTED [message]\(**/
		     suppresses any intra-file warning	except	those  dealing
		     with  unused  variables  or  functions.   This  directive
		     should be placed on the line immediately preceding	 where
		     the  lint warning occurred.  The -k option alters the way
		     in which lint handles this directive.   Instead  of  sup‐
		     pressing  messages, lint prints an additional message, if
		     any, contained in the comment.  This directive is	useful
		     in	 conjunction  with the -s option for post-lint filter‐
		     ing.

	      /∗LINTLIBRARY∗/
		     when -o is invoked, writes to a  library  .ln  file  only
		     definitions  in the .c file it heads. This directive sup‐
		     presses complaints about unused  functions	 and  function
		     arguments in this file.

	      /∗NOTREACHED∗/
		     at	 appropriate  points  stops comments about unreachable
		     code.  [This comment is typically placed just after calls
		     to functions like exit(2)].

	      /∗PRINTFLIKEn∗/
		     makes lint check the first (n-1) arguments as usual.  The
		     nth argument is interpreted as  a	printf	format	string
		     that is used to check the remaining arguments.

	      /∗PROTOLIBn∗/
		     causes  lint  to treat function declaration prototypes as
		     function definitions if n is  non-zero.   This  directive
		     can  only	be used in conjunction with the /∗ LINTLIBRARY
		     ∗/ directive.  If n  is  zero,  function  prototypes  are
		     treated normally.

	      /∗SCANFLIKEn∗/
		     makes lint check the first (n-1) arguments as usual.  The
		     nth argument is interpreted as a scanf format string that
		     is used to check the remaining arguments.

	      /∗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 miss‐
		     ing n is taken to be 0.  The use of the ellipsis termina‐
		     tor  (...)	 in  the  definition  is  suggested  in new or
		     updated code.

       lint directives can also be specified in the form of source code	 anno‐
       tations, by including the file note.h, for example:
	    #include <note.h>

	    NOTE(ARGSUSED(n))
	    NOTE(CONSTANTCONDITION)
	    NOTE(EMPTY)
	    NOTE(FALLTHROUGH)
	    NOTE(LINTLIBRARY)
	    NOTE(LINTED(message))
	    NOTE(NOTREACHED)
	    NOTE(PRINTFLIKE(n))
	    NOTE(PRINTFLIKE(func_name,n))
	    NOTE(PROTOLIB(n))
	    NOTE(SCANFLIKE(n))
	    NOTE(SCANFLIKE(func_name,n))
	    NOTE(VARARGS(n))
	    NOTE(VARARGS(func_name,n))

       The following two directives can be used only as annotations:

       NOTE(ALIGNMENT(func_name,n))
	      where n=1,2,4,8,16,32,64,128;
	      makes  lint  set following function result alignment in n bytes.
	      For example,  malloc() is defined as returning a char∗  or void∗
	      when  in	fact it really returns pointers that are word (or even
	      doubleword) aligned.

       NOTE(ARGUNUSED(par_name[,par_name...]))
	      makes lint  not check the mentioned arguments  for  usage	 (this
	      option acts only for the next function).

       lint  can,  with	 certain  options, show precise source file lines with
       pointers to the line position where the	error  occurred.   The	option
       enabling this feature is
       -errfmt=[macro|simple|src|tab].	 Under	this option, lint provides the
       following information:
	 · Source line(s) and position(s)
	 · Macro unfolding
	 · Error-prone stack(s)

       lint produces its first output on a per-source-file basis.   Complaints
       regarding  included  files  are	collected and printed after all source
       files have been processed, if -s is not specified.  Finally, if the  -C
       or  -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 complaint stems from a given source file or from one of
       its included files, the source filename is printed followed by a	 ques‐
       tion mark.

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

ENVIRONMENT
       TMPDIR		       usually	/tmp  but  can be redefined by setting
			       the environment variable TMPDIR [see tempnam in
			       tmpnam(3S)].

       NOTEPATH		       Colon separated paths of directories containing
			       note definition files (see C User's Guide)

FILES
       lint[12]		       first and second passes

       lint2n		       enhanced second pass

       llib-lc.ln	       declarations for C  Library  functions  (binary
			       format)

       TMPDIR/∗lint∗	       temporaries

SEE ALSO
       cc(1), make(1s), cflow(1), cxref(1).
       See the lint chapter in the C User's Guide.

				  2007/04/25			       lint(1)
[top]

List of man pages available for OpenIndiana

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net