allow full paths for library names in shell script lint

This commit is contained in:
dick 1991-03-12 10:58:22 +00:00
parent 3e18caaab0
commit 20b17c3eb2
2 changed files with 43 additions and 36 deletions

View file

@ -10,11 +10,13 @@ PATH=/bin:/usr/bin
EMLINT=/home/top/dick/lint EMLINT=/home/top/dick/lint
LPASS1="$EMLINT/lpass1/lnt -Dmc68000" # pass 1 program #LDEFMACH=-Dmc68000
LPASS2="$EMLINT/lpass2/lpass2" # pass 2 program
LLLIB="$EMLINT/llib" # lint libraries directory
LINTLIB=${LINTLIB-$LLLIB} LPASS1=${LPASS1-"$EMLINT/lpass1/lnt $LDEFMACH"} # pass 1 program
LPASS2=${LPASS2-"$EMLINT/lpass2/lpass2"} # pass 2 program
LLIB=${LLIB-"$EMLINT/llib"} # lint libraries directory
LINTLIB=${LINTLIB-$LLIB}
TMP=/usr/tmp/lint1.$$ TMP=/usr/tmp/lint1.$$
NEW=/usr/tmp/lint2.$$ NEW=/usr/tmp/lint2.$$
@ -68,7 +70,7 @@ case "$LIBRARY" in
do do
case $F in case $F in
-l) # do NOT include c.llb -l) # do NOT include c.llb
LIBC= LIBC=false
;; ;;
-lc) # do include c.llb -lc) # do include c.llb
LIBC=true LIBC=true
@ -100,7 +102,6 @@ case "$LIBRARY" in
esac esac
) | ) |
sort -u | sort -u |
tee /tmp/\#lint.debug |
( # pass 2: divert messages to avoid interleaving ( # pass 2: divert messages to avoid interleaving
$LPASS2 $PARAMS2 2>$TMP $LPASS2 $PARAMS2 2>$TMP
) )
@ -113,7 +114,7 @@ case "$LIBRARY" in
?*) # making a lint library ?*) # making a lint library
set -e # stop at first sign of trouble set -e # stop at first sign of trouble
case "$LIBRARY" in case `basename $LIBRARY` in
*.llb) # OK *.llb) # OK
;; ;;
*) # no suffix .llb *) # no suffix .llb

View file

@ -2,7 +2,7 @@
.\" See the copyright notice in the ACK home directory, in the file "Copyright". .\" See the copyright notice in the ACK home directory, in the file "Copyright".
.\" .\"
.\" $Header$ .\" $Header$
.TH LINT 1 88/10/13 .TH LINT 1 89/10/04
.SH NAME .SH NAME
lint \- a C program checker lint \- a C program checker
.SH SYNOPSIS .SH SYNOPSIS
@ -29,7 +29,7 @@ When it detects a doubtful construction
.PP .PP
It does a full flow-of-control check, except that It does a full flow-of-control check, except that
.BR goto s .BR goto s
are not followed and that the fact that a function does not return are not followed and that the fact that a function never returns
is not propagated. is not propagated.
If, however, no If, however, no
.BR goto s .BR goto s
@ -38,16 +38,17 @@ are used, each call of a non-returning function is followed by
of /*NOTREACHED*/), the initialization state of all local variables will of /*NOTREACHED*/), the initialization state of all local variables will
be checked correctly. be checked correctly.
.PP .PP
It checks the types of the arguments implied by the format in a call of .I Lint
checks the types of the arguments implied by the format in a call of
.IR printf() , .IR printf() ,
.IR scanf() .IR scanf()
and family, if the format-string is a direct argument in the call. and family, if the format string is a direct argument in the call.
Formats of user functions can be indicated using a FORMAT pseudo-comment; see Formats of user functions can be indicated using a FORMAT pseudo-comment; see
below. below.
.PP .PP
.I Libraries .I Libraries
.PP .PP
The second command (the The second command (using the
.BR \-L -option) .BR \-L -option)
is used to maintain lint libraries; these are ASCII files is used to maintain lint libraries; these are ASCII files
that contain the output of the first pass. that contain the output of the first pass.
@ -57,7 +58,7 @@ A lint user library can be created and updated by using the
.B \-L .B \-L
option. The option. The
.I libname .I libname
must be a local file, end in end in
.BR .llb , .BR .llb ,
and can be passed to and can be passed to
.I lint .I lint
@ -132,11 +133,11 @@ Complain about unused external variables.
The following pseudo-comments can be used to influence the behaviour of The following pseudo-comments can be used to influence the behaviour of
.IR lint: .IR lint:
.TP .TP
/* ARGSUSED */ /*\ ARGSUSED\ */
Do not warn about arguments not used in the next function Do not warn about arguments not used in the next function
(see also the \-\fBv\fR option). (see also the \-\fBv\fR option).
.TP .TP
/* NOTREACHED */ /*\ NOTREACHED\ */
This tells This tells
.I lint .I lint
that the flow of control "cannot reach" this comment. that the flow of control "cannot reach" this comment.
@ -144,28 +145,29 @@ This is a way to tell
.I lint .I lint
that a statement never "returns". that a statement never "returns".
.TP .TP
/* LINTLIBRARY */ /*\ LINTLIBRARY\ */
The following definitions are assumed to be part of a library. The definitions following this pseudo-comment are assumed to be part of a
library.
It suppresses complaints about unused functions and variables It suppresses complaints about unused functions and variables
and is used in the creation of lint libraries. and is used in the creation of lint libraries.
It implies /* ARGSUSED */. It implies /*\ ARGSUSED\ */.
.TP .TP
/* VARARGS\fIn\fR */ /*\ VARARGS\fIn\fR\ */
The next function can be called with a variable number of The next function can be called with a variable number of
arguments. arguments.
Only check the types of the first \fIn\fR arguments. Only check the types of the first \fIn\fR arguments.
The \fIn\fR must follow the word VARARGS immediately. The \fIn\fR must follow the word VARARGS immediately.
/* VARARGS0 */ may be abbreviated to /* VARARGS */. /*\ VARARGS0\ */ may be abbreviated to /*\ VARARGS\ */.
.TP .TP
/* FORMAT\fIn\fR $ ... $ */ /*\ FORMAT\fIn\fR $ ... $\ */
The \fIn\fP-th argument (counting from 0) of the next function declaration The \fIn\fP-th argument (counting from 0) of the next function declaration
corresponds to a corresponds to a
.IR printf -like .IR printf -like
format string. Details about the format are given between the $$; see below. format string. Details about the format are given between the $$; see below.
A missing $$ repeats the latest format. A missing $$ repeats the latest format.
The \fIn\fR must follow the word FORMAT immediately. The \fIn\fR must follow the word FORMAT immediately.
/* FORMAT\fIn\fR $ ... $ */ implies /* VARARGS\fIn+1\fP */; if the format /*\ FORMAT\fIn\fR $ ... $\ */ implies /*\ VARARGS\fIn+1\fP\ */; if the format
is followed by more required arguments, a separate /* VARARGS\fIm\fP */ is followed by more required arguments, a separate /*\ VARARGS\fIm\fP\ */
must be given after the FORMAT pseudo-comment. must be given after the FORMAT pseudo-comment.
.IP .IP
If the printf-like heading also has to conform to some varargs.h convention, If the printf-like heading also has to conform to some varargs.h convention,
@ -174,21 +176,27 @@ to the word FORMAT\fIn\fR without intervening space.
.PP .PP
.I Formats .I Formats
.PP .PP
.I Lint The $$-part of the FORMAT pseudo-comment consists of a list of format
recognizes conversion specifications of the form %[N|*|][.[N|*]]X where X specifications, each of the form
is an arbitrary string, given in the $$-part of the FORMAT pseudo-comment. .IR %T = type ,
The latter consists of a list of format specifications, each of the form
.IR %X = type ,
where where
.I T
is an arbitrary (short) string and
.I type .I type
is the expected type in "C normal form" (like in a cast, with no superfluous is the expected type in "C normal form" (like in a cast, with no superfluous
parentheses and without the use of typedefs). parentheses and without the use of typedefs). E.g., %ld=long indicates that
the format string ld corresponds to a parameter of type long. For a shorter
notation see the example below.
.I Lint
recognizes conversion specifications of the form %[N|*|][.[N|*]]T where N is
a number, the * is itself and T is a string as defined above. For the above
example this would include %ld, %5.2ld, %.*ld, etc.
.PP .PP
Example: the FORMAT pseudo-comment for Example: the FORMAT pseudo-comment for
.I printf() .I printf()
is: is:
.br .br
/* FORMAT0 $ /*\ FORMAT0 $
.br .br
%[dox] = int %l[dox] = long %[DOX] = long %[dox] = int %l[dox] = long %[DOX] = long
.br .br
@ -198,7 +206,7 @@ is:
.br .br
%c = int %s = char * %c = int %s = char *
.br .br
$ */ $\ */
.PP .PP
.I Output .I Output
.PP .PP
@ -229,8 +237,6 @@ Frans Kunst,
Conflicting options in the command line are not detected. Conflicting options in the command line are not detected.
.br .br
After a label, all automatic variables are assumed initialized. After a label, all automatic variables are assumed initialized.
.br
Initializations hidden inside for statements are sometimes overlooked.
.SH AUTHOR .SH AUTHOR
Frans Kunst, Vrije Universiteit, Amsterdam. Frans Kunst, Vrije Universiteit, Amsterdam.
.br .br