Module Name: src
Committed By: rillig
Date: Fri Jan 3 20:53:01 UTC 2025
Modified Files:
src/usr.bin/xlint/xlint: lint.1
Log Message:
lint.1: modernize, brush up markup
The main purpose of lint is no longer to help migrate programs from
traditional C to C90, so don't mention those features prominently.
To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/usr.bin/xlint/xlint/lint.1
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/xlint/lint.1
diff -u src/usr.bin/xlint/xlint/lint.1:1.65 src/usr.bin/xlint/xlint/lint.1:1.66
--- src/usr.bin/xlint/xlint/lint.1:1.65 Sun Jan 21 14:11:52 2024
+++ src/usr.bin/xlint/xlint/lint.1 Fri Jan 3 20:53:01 2025
@@ -1,4 +1,4 @@
-.\" $NetBSD: lint.1,v 1.65 2024/01/21 14:11:52 rillig Exp $
+.\" $NetBSD: lint.1,v 1.66 2025/01/03 20:53:01 rillig Exp $
.\"
.\" Copyright (c) 1996 Christopher G. Demetriou. All Rights Reserved.
.\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -30,7 +30,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd January 21, 2024
+.Dd January 3, 2025
.Dt LINT 1
.Os
.Sh NAME
@@ -42,7 +42,7 @@
.Op Fl i | Fl nu
.Op Fl S | Fl s | Fl t | Fl Ac11 | Fl Ac23
.Op Fl B Ar directory
-.Op Fl D Ar name Ns Op =def
+.Op Fl D Ar name Ns Op = Ns Ar def
.Op Fl d Ar directory
.Op Fl I Ar directory
.Op Fl L Ar directory
@@ -55,6 +55,7 @@
.Op Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
.Op Fl Z Ar cpparg
.Ar
+.Pp
.Nm lint
.Op Fl abceFgHhprTVvwz
.Op Fl S | Fl s | Fl t | Fl Ac11 | Fl Ac23
@@ -64,7 +65,7 @@
.Op Fl d Ar directory
.Op Fl I Ar directory
.Op Fl MD
-.Op Fl R Ar old=new
+.Op Fl R Ar old Ns No = Ns Ar new
.Op Fl U Ar name
.Op Fl W Ar cppwarnarg
.Op Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
@@ -84,6 +85,7 @@ produces are enumerated in
In the first synopsis form,
.Nm
checks each given file as a separate translation unit.
+.Pp
In the second synopsis form,
.Nm
cross-checks the results of the first synopsis form for inconsistencies
@@ -102,23 +104,10 @@ These symbols should therefore be though
words for all code that is to be checked by
.Nm .
.Pp
-Among the possible problems that are currently noted are
-unreachable statements, loops not entered at the top,
-variables declared and not used, and logical expressions
-with constant values.
-Function calls are checked for
-inconsistencies, such as calls to functions that return
-values in some places and not in others, non-prototype functions called
-with varying numbers of arguments, non-prototype function calls that
-pass arguments of a type other than the type the function
-expects to receive, functions whose return values are not used,
-and calls to non-prototype functions not returning values that nevertheless use
-the non-existent return value of the function.
-.Pp
Filename arguments ending with
.Pa \&.c
are taken to be C source files.
-Filename arguments with names ending with
+Filename arguments ending with
.Pa \&.ln
are taken to be the result of an earlier invocation of
.Nm ,
@@ -179,7 +168,7 @@ but from one of its included files, the
printed followed by a question mark.
.Pp
.Sy Options
-.Bl -tag -width XXoutputfile
+.Bl -tag
.It Fl Ac11
Allow features from C11, C99 and C90.
.It Fl Ac23
@@ -196,7 +185,7 @@ report
.Em all
assignments of integer values to other integer values which
cause implicit narrowing conversion.
-.It Fl B Ns Ar path
+.It Fl B Ar path
Path to use when looking for the lint1 and lint2 binaries.
Defaults to
.Pa /usr/libexec .
@@ -209,7 +198,7 @@ This is not the default because, unfortu
and many
.Xr yacc 1
outputs produce many such complaints.
-.It Fl C Ns Ar library
+.It Fl C Ar library
Create a
.Nm
library with the name
@@ -227,7 +216,7 @@ checks all input files, including librar
option, for mutual compatibility.
.It Fl c
Complain about casts which have questionable portability.
-.It Fl D Ns Ar name Ns Op =def
+.It Fl D Ar name Ns Op = Ns Ar def
Define
.Ar name
for
@@ -238,7 +227,7 @@ directive.
If no definition is given,
.Ar name
is defined as 1.
-.It Fl d Ns Ar directory
+.It Fl d Ar directory
Use
.Ar directory
as the root directory
@@ -258,25 +247,12 @@ normally prints the filename without the
Don't print warnings for some extensions of
.Xr gcc 1
to the C language.
-Currently these are nonconstant initializers in automatic aggregate
-initializations, arithmetic on pointer to void, trailing commas in
-enum declarations, C++ -style
-.Dq //
-comments,
-zero sized structures, subscripting of non-lvalue arrays, prototypes
-overriding old-style function declarations and long long
-integer types.
The
.Fl g
-flag also turns on the keywords
-.Sy asm
-and
-.Sy inline
-(alternative keywords with leading underscores for both
+flag also turns on some GCC-specific keywords such as
.Sy asm
-and
-.Sy inline
-are always available).
+or
+.Sy typeof .
.It Fl H
If a complaint stems from an included file,
print the name of the included file instead of the source file name
@@ -284,7 +260,7 @@ followed by a question mark.
.It Fl h
Apply a number of heuristic tests to attempt to intuit
bugs, improve style, and reduce waste.
-.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.
@@ -300,13 +276,13 @@ files are the product of
.Nm Ns 's
first pass only, and are not checked for compatibility
between functions.
-.It Fl L Ns Ar directory
+.It Fl L Ar directory
Search for lint libraries in
.Ar directory
and
.Ar directory Ns Pa /lint
before searching the standard place.
-.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 MD
@@ -318,7 +294,7 @@ causing cpp to create files containing d
each source file.
.It Fl n
Do not check compatibility against the standard library.
-.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
@@ -356,7 +332,7 @@ that may be interesting to look at on a
The most convenient way to run queries on a source file is to run:
.Pp
.Dl make LINT=\*qlint \-q3,5,7\*q source.ln
-.It Fl R Ar old=new
+.It Fl R Ar old Ns No = Ns Ar new
Remap
.Ar old
directory prefixes to
@@ -366,7 +342,6 @@ for reproducible builds.
In case of redeclarations, report the position of the previous declaration.
.It Fl S
C99 mode.
-Currently not fully implemented.
.It Fl s
Strict ISO C90 mode.
Issue warnings and errors required by ISO C90, as opposed to traditional C.
@@ -400,7 +375,7 @@ and
.Sy signed
are not available in traditional C mode (although the alternative
keywords with leading underscores still are).
-.It Fl U Ns Ar name
+.It Fl U Ar name
Remove any initial definition of
.Ar name
for the preprocessor.
@@ -423,8 +398,8 @@ Pass the warning directive to
.It Fl w
Treat warnings as errors.
.It Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
-Suppress error messages identified by the list of ids.
-A list of messages and ids can be found in
+Suppress error messages identified by the list of IDs.
+A list of messages and IDs can be found in
.Xr lint 7 .
.It Fl x
Report variables referred to by
@@ -453,7 +428,7 @@ first pass reads standard C source files
.Nm
recognizes the following C comments as commands.
.Bl -tag -width Fl
-.It Li /* ARGSUSED Ns Ar n Li */
+.It Li /* ARGSUSED Ar n Li */
Makes
.Nm
check only the first
@@ -480,7 +455,7 @@ At the beginning of a file, mark all fun
in this file as
.Em used .
Also shut off complaints about unused function parameters.
-.It Li /* LINTED Ns Ar n Oo Ar comment Oc Li */ No or Li /* NOSTRICT Ns Ar n Oo Ar comment Oc Li */
+.It Li /* LINTED Ar n Oo Ar comment Oc Li */ No or Li /* NOSTRICT Ar n Oo Ar comment Oc Li */
Suppresses any intra-file warning except those dealing with
unused variables or functions.
This directive should be placed
@@ -496,7 +471,7 @@ At appropriate points, inhibit complaint
(This comment is typically placed just after calls to functions
like
.Xr exit 3 ) .
-.It Li /* PRINTFLIKE Ns Ar n Li */
+.It Li /* PRINTFLIKE Ar n Li */
Makes
.Nm
check the first
@@ -507,7 +482,7 @@ The
argument is interpreted as a
.Sy printf
format string that is used to check the remaining arguments.
-.It Li /* PROTOLIB Ns Ar n Li */
+.It Li /* PROTOLIB Ar n Li */
Causes
.Nm
to treat function declaration prototypes as function definitions
@@ -520,7 +495,7 @@ directive.
If
.Ar n
is zero, function prototypes will be treated normally.
-.It Li /* SCANFLIKE Ns Ar n Li */
+.It Li /* SCANFLIKE Ar n Li */
Makes
.Nm
check the first
@@ -531,7 +506,7 @@ The
argument is interpreted as a
.Sy scanf
format string that is used to check the remaining arguments.
-.It Li /* VARARGS Ns Ar n Li */
+.It Li /* VARARGS Ar n Li */
Suppress the usual checking for variable numbers of arguments in
the following function declaration.
The data types of the first
@@ -573,11 +548,9 @@ This scheme works well with
.Xr make 1 ;
it allows
.Xr make 1
-to be used to
-.Nm
+to be used to lint
only the source files that have been modified since the last
-time the set of source files were
-.Nm Ns No ed .
+time the set of source files were linted.
.Sh EXIT STATUS
.Ex -std lint
If the
@@ -602,10 +575,11 @@ and
exits unsuccessfully, do no delete the output from the C preprocessor,
allowing for manual inspection.
.It Ev TMPDIR
-Usually the path for temporary files can be redefined by setting
-this environment variable.
+The directory where
+.Nm
+stores temporary files.
.It Ev CC
-Location of the C compiler program.
+The location of the C compiler program.
Defaults to
.Pa /usr/bin/cc .
.El
@@ -653,18 +627,9 @@ and strict bool mode.
.An Jochen Pohl
(1995)
.An Roland Illig
-(2021 to 2023)
+(2021 to 2025)
.\" .Sh CAVEATS
.Sh BUGS
-The routines
-.Xr exit 3 ,
-.Xr longjmp 3
-and other functions that do not return are not understood; this
-causes various incorrect diagnostics.
-.Pp
-Static functions which are used only before their first
-extern declaration are reported as unused.
-.Pp
Libraries created by the
.Fl o
option will, when used in later