Man Page 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:
       o Unreachable statements
       o Loops not entered at the top
       o Automatic variables declared and not used
       o 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 every-
     thing done by basic lint, plus provides additional, detailed
     analysis of code.

     In enhanced mode, the analysis includes:
       o Structure and flow analysis of source program
       o Constant propagations and  constant  expression  evalua-
         tions
       o Analysis of control flow and data flow
       o Analysis of data types usages

     Thus, lint can detect the  following  problems  in  enhanced
     mode:
       o Unused #include directives, variables, and procedures
       o Memory usage after its deallocation
       o Unused assignments
       o Usage of a variable value before its initialization
       o Deallocation of non-allocated memory
       o Usage of pointers when writing in constant data segment
       o Non-equivalent macro redefinitions
       o Unreached code
       o Nonconformity of the usages of value types in unions
       o 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;  arguments  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 produced 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  addi-
     tional information 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, inter-
     mixed 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
          variables 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  command  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  por-
          tability  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=longptr64,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 warn-
                  ing, 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  assignment   between   same   size
                  integers  which differ in signedness; for exam-
                  ple, 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  integers,
                  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
          following: 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  brackets,  of the error, for one-line (sim-
                  ple) diagnostic messages.  Similar  to  the  -s
                  option,  but  includes  error-position informa-
                  tion.

          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 for-
          mats.

     -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 subdirectories, 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 fol-
          lowing: 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 -errsecu-
          rity   without   a    flag,    lint    sets    it    to
          -errsecurity=standard.

          core     This level checks for source  code  constructs
                   that are almost always either unsafe or diffi-
                   cult 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() functions
                   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 alternatives are avail-
                   able.

          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  tem-
                   porary 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 review-
                   ing 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 con-
                   ditions

                   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 secu-
                   rity 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. Speci-
          fying -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 warn-
                   ing 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 warn-
                   ing 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
                   warning message.

          %all     Cause lint to exit with a fatal status if  any
                   warning  messages are issued. %all can be fol-
                   lowed 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 stan-
          dard 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  com-
          ment inside the directive or annotation.

     -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 inserting -lm on the command line.  This argu-
          ment  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  memory  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 sufficient for lint-
          ing 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 declara-
                  tions 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 declarations 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 verifica-
          tion 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  uncondi-
          tional  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 uncondi-
          tional errors that  occur  on  some  program  execution
          paths.

          -Nlevel=3 Analyze the whole program, including constant
          propagation,  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 program 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
          available  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  diag-
          nosed.

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

          At this level, there  are  additional  diagnostic  mes-
          sages.  The analysis algorithm generally corresponds to
          the analysis algorithm 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 com-
          plexity  as  characterised  by  recursion,  conditional
          statements  etc.  As a result of this, it may be diffi-
          cult to use this level of analysis 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  inter-
          faces.  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  for-
          mat.  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 charac-
          ters and one case.

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

     -s   Produce simple diagnostics with "warning:" or  "error:"
          prefixes. By default lint buffers some messages to pro-
          duce compound output.

     -u   Suppress complaints about functions and external  vari-
          ables  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   Write to standard error the product name and release.

     -v   Suppress complaints about  unused  arguments  in  func-
          tions.

     -Wfile
          Write a .ln file to file, for use  by  cflow(1).   This
          option  disables  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 infor-
          mation.

          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 com-
          piled, 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  particular, // 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 indicated 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  features  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  mes-
          sages,  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  direc-
          tives.  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 equivalent 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 -Xtransition=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  stan-
          dard,  this  option enables recognition of non-standard
          C.

          You can turn off lint  recognition  of  U"ASCII_string"
          string  literals 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  argument,  the compiler won't accept it and instead
          issues a warning. The default can change if  the  C  or
          C++ standards define a meaning for the syntax.

          You can specify -Xustr=ascii_ustf16_ushort without also
          specifying  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 direc-
               tive acts like the -v option for  the  next  func-
               tion).

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

          /*EMPTY*/
               suppresses complaints about a null statement  con-
               sequent on an if statement.  This directive should
               be placed after the test  expression,  and  before
               the semicolon.  This directive is supplied to sup-
               port empty if statements when a valid else  state-
               ment  follows.  It suppresses messages 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 suppressing messages, lint
               prints an additional message, if any, contained in
               the comment.  This directive is useful in conjunc-
               tion with the -s option for post-lint filtering.

          /*LINTLIBRARY*/
               when -o is invoked, writes to a library  .ln  file
               only  definitions  in  the  .c file it heads. This
               directive suppresses complaints about unused func-
               tions 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  proto-
               types  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 declara-
               tion.  The data types of the first n arguments are
               checked; a missing n is taken to be 0.  The use of
               the ellipsis terminator (...) in the definition is
               suggested in new or updated code.

     lint directives can also be specified in the form of  source
     code annotations, 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  annota-
     tions:

     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 pro-
     vides the following information:
       o Source line(s) and position(s)
       o Macro unfolding
       o 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 question mark.

     The behavior of the -C, -c, and the -o  options  allows  for
     incremental  use  of  lint on a set of C source files.  Gen-
     erally, 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  mes-
     sages  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 inconsistencies.  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.