mdoc(7) police: fix markup.

(Shows how powerful new -mdoc is.)
This commit is contained in:
Ruslan Ermilov 2001-04-27 10:13:20 +00:00
parent 30934e7df0
commit 3520eff8da
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=76065

View File

@ -33,56 +33,32 @@
.\"
.Dd August 28, 1994
.Dt LINT 1
.Os FreeBSD
.Os
.Sh NAME
.Nm lint
.Nd a C program verifier
.Sh SYNOPSIS
.Bk -words
.Nm
.Op Fl abceghprvxzHFV
.Bk -words
.Op Fl s | Fl t
.Ek
.Bk -words
.Op Fl i | Fl nu
.Ek
.Bk -words
.Op Fl D Ar name Ns Op =def
.Ek
.Bk -words
.Op Fl s | t
.Op Fl i | nu
.Op Fl D Ar name Ns Op = Ns Ar def
.Op Fl U Ar name
.Ek
.Bk -words
.Op Fl I Ar directory
.Ek
.Bk -words
.Op Fl L Ar directory
.Ek
.Bk -words
.Op Fl l Ar library
.Ek
.Bk -words
.Op Fl o Ar outputfile
.Ek
.Ar
.Nm
.Op Fl abceghprvzHFV
.Bk -words
.Op Fl s | Fl t
.Ek
.Bk -words
.Op Fl s | t
.Fl C Ar library
.Ek
.Bk -words
.Op Fl D Ar name Ns Op =def
.Ek
.Bk -words
.Op Fl D Ar name Ns Op = Ns Ar def
.Op Fl I Ar directory
.Ek
.Bk -words
.Op Fl U Ar name
.Ek
.Ar
.Ek
.Sh DESCRIPTION
.Nm
attempts to detect features of the named C program files
@ -93,7 +69,7 @@ the C compiler.
.Nm
runs the C preprocessor as its first phase, with the
preprocessor symbol
.Sy lint
.Dq Dv lint
defined to allow certain questionable code to be altered
or skipped by
.Nm .
@ -115,27 +91,26 @@ and calls to functions not returning values that use
the non-existent return value of the function.
.Pp
Filename arguments ending with
.Pa \&.c
.Pa .c
are taken to be C source files.
Filename arguments with
names ending with
.Pa \&.ln
.Pa .ln
are taken to be the result of an earlier invocation of
.Nm ,
with either the
.Fl i ,
.Fl o ,
.Fl i , o ,
or
.Fl C
option in effect.
The
.Pa \&.ln
.Pa .ln
files are analogous to the
.Pa \&.o
.Pa .o
(object) files produced by
.Xr cc 1
from
.Pa \&.c
.Pa .c
files.
.Nm
also accepts special libraries specified with the
@ -145,9 +120,9 @@ variables.
.Pp
.Nm
takes all the
.Pa \&.c , \&.ln ,
.Pa .c , .ln ,
and
.Pa llib-l Ns Ar library Ns Pa \&.ln
.Pa llib-l Ns Ar library Ns Pa .ln
(lint library) files and processes them in command-line order.
By default,
.Nm
@ -157,14 +132,14 @@ to the end of the list of files.
When the
.Fl i
option is used, the
.Pa \&.ln
.Pa .ln
files are ignored.
Also, when the
.Fl o
or
.Fl i
options are used, the
.Pa llib-l Ns Ar library Ns Pa \&.ln
.Pa llib-l Ns Ar library Ns Pa .ln
files are ignored.
When the
.Fl i
@ -179,12 +154,12 @@ its included files, the source filename will be printed followed by
a question mark.
.Pp
The options are as follows:
.Bl -tag -width Ds
.Bl -tag -width indent
.It Fl a
Report assignments of
.Sy long
.Vt long
values to variables that are not
.Sy long .
.Vt long .
.It Fl aa
Additional to
.Fl a ,
@ -194,7 +169,7 @@ assignments of integer values to other integer values which
cause implicit narrowing conversion.
.It Fl b
Report
.Sy break
.Ic break
statements that cannot be reached.
This is not the default
because, unfortunately, most
@ -206,11 +181,11 @@ outputs produce many such complaints.
Complain about casts which have questionable portability.
.It Fl e
Complain about unusual operations on
.Sy enum Ns -Types
.Vt enum Ns -Types
and combinations of
.Sy enum Ns -
.Vt enum Ns -
and
.Sy integer Ns -Types .
.Vt int Ns eger-Types .
.It Fl g
Don't print warnings for some extensions of
.Xr gcc 1
@ -223,25 +198,25 @@ integer types.
The
.Fl g
flag also turns on the keywords
.Sy asm
.Ic asm
and
.Sy inline
.Ic inline
(alternate keywords with leading underscores for both
.Sy asm
.Ic asm
and
.Sy inline
.Ic inline
are always available).
.It Fl h
Apply a number of heuristic tests to attempt to intuit
bugs, improve style, and reduce waste.
.It Fl i
Produce a
.Pa \&.ln
.Pa .ln
file for every
.Pa \&.c
.Pa .c
file on the command line.
These
.Pa \&.ln
.Pa .ln
files are the product of
.Nm Ns 's
first pass only, and are not checked for compatibility
@ -257,29 +232,30 @@ previous declaration.
Strict ANSI C mode.
Issue warnings and errors required by ANSI C.
Also do not produce warnings for constructs which behave
differently in traditional C and ANSI C. With the
differently in traditional C and ANSI C.
With the
.Fl s
flag,
.Li __STRICT_ANSI__
.Dv __STRICT_ANSI__
is a predefined preprocessor macro.
.It Fl t
Traditional C mode.
.Li __STDC__
.Dv __STDC__
is not predefined in this mode.
Warnings are printed for constructs
not allowed in traditional C. Warnings for constructs which behave
not allowed in traditional C.
Warnings for constructs which behave
differently in traditional C and ANSI C are suppressed.
Preprocessor
macros describing the machine type (e.g.,
.Li sun3 Ns )
.Dv sun3 )
and machine architecture (e.g.,
.Li m68k Ns )
.Dv m68k )
are defined without leading and trailing underscores.
The keywords
.Sy const Ns ,
.Sy volatile
.Ic const , volatile
and
.Sy signed
.Ic signed
are not available in traditional C mode (although the alternate
keywords with leading underscores still are).
.It Fl u
@ -292,21 +268,21 @@ on a subset of files comprising part of a larger program).
Suppress complaints about unused arguments in functions.
.It Fl x
Report variables referred to by
.Sy extern
.Ic extern
declarations, but never used.
.It Fl z
Do not complain about structures that are never defined
(for example, using a structure pointer without knowing
its contents).
.It Fl C Ns Ar library
.It Fl C Ar library
Create a
.Nm
library with the name
.Pa llib-l Ns Ar library Ns Pa .ln .
This library is built from all
.Pa \&.c
.Pa .c
and
.Pa \&.ln
.Pa .ln
input files.
After all global definitions of functions and
variables in these files are written to the newly created library,
@ -314,25 +290,25 @@ variables in these files are written to the newly created library,
checks all input files, including libraries specified with the
.Fl l
option, for mutual compatibility.
.It Fl D Ns Ar name Ns Op =def
.It Fl D Ar name Ns Op = Ns Ar def
Define
.Ar name
for
.Xr cpp 1 ,
as if by a
.Li #define
.Ic #define
directive.
If no definition is given,
.Ar name
is defined as 1.
.It Fl I Ns Ar directory
.It Fl I Ar directory
Add
.Ar directory
to the list of directories in which to search for include files.
.It Fl l Ns Ar library
.It Fl l Ar library
Include the lint library
.Pa llib-l Ns Ar library Ns Pa \&.ln .
.It Fl L Ns Ar directory
.Pa llib-l Ns Ar library Ns Pa .ln .
.It Fl L Ar directory
Search for lint libraries in
.Ar directory
and
@ -347,7 +323,7 @@ If a complaint stems from an included file
.Nm
prints the name of the included file instead of the source file name
followed by a question mark.
.It Fl o Ns Ar outputfile
.It Fl o Ar outputfile
Name the output file
.Ar outputfile .
The output file produced is the input that is given to
@ -360,7 +336,7 @@ If the
.Fl i
option is also used the files are not checked for compatibility.
To produce a
.Pa llib-l Ns Ar library Ns Pa \&.ln
.Pa llib-l Ns Ar library Ns Pa .ln
without extraneous messages, use of the
.Fl u
option is suggested.
@ -368,7 +344,7 @@ The
.Fl v
option is useful if the source file(s) for the lint library
are just external interfaces.
.It Fl U Ns Ar name
.It Fl U Ar name
Remove any initial definition of
.Ar name
for the preprocessor.
@ -378,14 +354,12 @@ run the C preprocessor and
.Nm Ns 's
first and second pass.
.El
.Pp
.Sy Input Grammar
.Pp
.Ss Input Grammar
.Nm Ns 's
first pass reads standard C source files.
.Nm
recognizes the following C comments as commands.
.Bl -tag -width Fl
.Bl -tag -width indent
.It Li /* ARGSUSED Ns Ar n Li */
makes
.Nm
@ -396,18 +370,23 @@ arguments for usage; a missing
is taken to be 0 (this option acts like the
.Fl v
option for the next function).
.It Li /* CONSTCOND */ No or Xo
.Li /* CONSTANTCOND */ No or
.It Xo
.Li /* CONSTCOND */
or
.Li /* CONSTANTCOND */
or
.Li /* CONSTANTCONDITION */
.Xc
suppress complaints about constant operands for the next expression.
.It Li /*\ FALLTHRU\ */ No or Xo
.It Xo
.Li /* FALLTHRU */
or
.Li /* FALLTHROUGH */
.Xc
suppress complaints about fall through to a
.Sy case
.Ic case
or
.Sy default
.Ic default
labelled statement.
This directive should be placed immediately
preceding the label.
@ -416,12 +395,10 @@ At the beginning of a file, mark all functions and variables defined
in this file as
.Em used .
Also shut off complaints about unused function arguments.
.It Li /* LINTED Xo
.Op Ar comment
.Li */ No or
.Li /* NOSTRICT
.Op Ar comment
.Li */
.It Xo
.Li /* LINTED Oo Ar comment Oc Li */
or
.Li /* NOSTRICT Oo Ar comment Oc Li */
.Xc
Suppresses any intra-file warning except those dealing with
unused variables or functions.
@ -440,12 +417,12 @@ like
makes
.Nm
check the first
.Pq Ar n Ns No -1
.Pq Ar n Ns -1
arguments as usual.
The
.Ar n Ns No -th
.Ar n Ns -th
argument is interpreted as a
.Sy printf
.Xr printf 3
format string that is used to check the remaining arguments.
.It Li /* PROTOLIB Ns Ar n Li */
causes
@ -465,12 +442,12 @@ is zero, function prototypes will be treated normally.
makes
.Nm
check the first
.Pq Ar n Ns No -1
.Pq Ar n Ns -1
arguments as usual.
The
.Ar n Ns No -th
.Ar n Ns -th
argument is interpreted as a
.Sy scanf
.Xr scanf 3
format string that is used to check the remaining arguments.
.It Li /* VARARGS Ns Ar n Li */
Suppress the usual checking for variable numbers of arguments in
@ -495,9 +472,9 @@ once for each source file with the
.Fl i
option.
Each of these invocations produces a
.Pa \&.ln
.Pa .ln
file that corresponds to the
.Pa \&.c
.Pa .c
file, and prints all messages that are about just that
source file.
After all the source files have been separately
@ -506,10 +483,11 @@ run through
it is invoked once more (without the
.Fl i
option), listing all the
.Pa \&.ln
.Pa .ln
files with the needed
.Fl l Ns Ar library
options. this will print all the inter-file inconsistencies.
options.
This will print all the inter-file inconsistencies.
This
scheme works well with
.Xr make 1 ;
@ -519,12 +497,14 @@ to be used to
.Nm
only the source files that have been modified since the last
time the set of source files were
.Nm Ns No ed .
.Nm Ns ed .
.Sh ENVIRONMENT
.Bl -tag -width Fl
.Bl -tag -width LIBDIR
.It Ev LIBDIR
the directory where the lint libraries specified by the
.Fl l Ns Ar library
.Bk -words
.Fl l Ar library
.Ek
option must exist.
If this environment variable is undefined,
then the default path
@ -536,7 +516,7 @@ this environment variable.
.El
.Sh FILES
.Bl -tag -width /usr/libdata/lint/llib-lc.ln -compact
.It Pa /usr/libexec/lint Ns Bq 12
.It Pa /usr/libexec/lint Ns Bq Pa 12
programs
.It Pa /usr/libdata/lint/llib-l*.ln
various prebuilt lint libraries
@ -550,15 +530,17 @@ temporaries
.Sh AUTHORS
.An Jochen Pohl
.Sh BUGS
.Bl -item
.It
The routines
.Xr exit 3 ,
.Xr longjmp 3
and other functions that do not return are not understood; this
causes various incorrect diagnostics.
.Pp
.It
Static functions which are used only before their first
extern declaration are reported as unused.
.Pp
.It
Libraries created by the
.Fl o
option will, when used in later
@ -571,3 +553,4 @@ For these reasons, it is recommended
to use the
.Fl C
option to create lint libraries.
.El