[comp.unix.misc] Human-readable lint libraries

elias@theory.tn.cornell.edu (Doug Elias) (10/20/90)

As the last line of the Sun man-page for "lint" reads:
  ...it is still useful to produce stripped down lint library 
  source files and to use  them  to generate lint libraries.

However, there are no flags (or combinations of same) which
seem to result in the production of said "stripped down lint
library source files".  Does anyone out there have any suggestions
(besides the obvious -- "make it yourself by hand") as to how
to go about creating these?  One of the people in the group
is currently writing a simple little program which will pull
out all #includes and function definitions, but if somebody out 
there already has some s/w which creates lint source files, we'd
really like to hear about it.

Many thanks, and please respond via email.

doug
-- 
#    ____       Internet:   elias@theory.tn.cornell.edu
#  dr _|_)oug   USmail:     Adv. Comp. Res. Inst./Cornell Theory Center
#    (_|                    704A TheoryCtrBldg/C.U./Ithaca/N.Y./14853-5201
#    (_|__      MaBelle:    607-254-8826   Fax: 607-254-8888

mutchler@zule.EBay.Sun.COM (Dan Mutchler) (10/20/90)

In article <1990Oct19.172042.26917@batcomputer.tn.cornell.edu> elias@theory.tn.cornell.edu (Doug Elias) writes:

   As the last line of the Sun man-page for "lint" reads:
     ...it is still useful to produce stripped down lint library 
     source files and to use  them  to generate lint libraries.

   However, there are no flags (or combinations of same) which
   seem to result in the production of said "stripped down lint
   library source files".  Does anyone out there have any suggestions
   (besides the obvious -- "make it yourself by hand") as to how
   to go about creating these?  One of the people in the group
   is currently writing a simple little program which will pull
   out all #includes and function definitions, but if somebody out 
   there already has some s/w which creates lint source files, we'd
   really like to hear about it.

   Many thanks, and please respond via email.

   doug
   -- 
   #    ____       Internet:   elias@theory.tn.cornell.edu
   #  dr _|_)oug   USmail:     Adv. Comp. Res. Inst./Cornell Theory Center
   #    (_|                    704A TheoryCtrBldg/C.U./Ithaca/N.Y./14853-5201
   #    (_|__      MaBelle:    607-254-8826   Fax: 607-254-8888



From the lint manual page:

	-Clibrary
		Create a lint library with the name llib-llibrary.ln.

Also, -i will generate a .ln file with just the routines and the call
lines.
--

Dan Mutchler                       | ARPA/Internet:  mutchler@zule.EBay.Sun.COM
Sun Federal System Engineer        | UUCP:           ...!sun!mutchler
--------------------------------------------------------------------------
Flying back from Lubbock, I saw Jesus on the plane
Or maybe it was Elvis, You know they kind of look the same.
                     -- Don Henley

lm@slovax.Sun.COM (Larry McVoy) (10/21/90)

In article <1990Oct19.172042.26917@batcomputer.tn.cornell.edu> elias@theory.tn.cornell.edu (Doug Elias) writes:
>As the last line of the Sun man-page for "lint" reads:
>  ...it is still useful to produce stripped down lint library 
>  source files and to use  them  to generate lint libraries.

Sigh.  Doing it by hand is usually required.  You pick up cproto off of one
of the archives and modify it trivially to produce a 90% solution.  You still
have to pick up things like

int	errno;	/* declare errno because it is an exported global */

and cproto won't help you there.

The other thing you can do is just use the real source.  I discourage this
within Sun because we like to ship the source to the lint libs;
programmers actually grep through them to see which way the args go.
This means that you should say

bcopy(src, dest, len)

not

bcopy(p1, p2, i)

Using cproto usually works for this because the source is usually good
about meaningful names.
---
Larry McVoy, Sun Microsystems     (415) 336-7627       ...!sun!lm or lm@sun.com

guy@auspex.auspex.com (Guy Harris) (10/31/90)

 >   However, there are no flags (or combinations of same) which
 >   seem to result in the production of said "stripped down lint
 >   library source files".

...

 >From the lint manual page:
 >
 >	-Clibrary
 >		Create a lint library with the name llib-llibrary.ln.
 >
 >Also, -i will generate a .ln file with just the routines and the call
 >lines.

Nice try, but a ".ln" file is *NOT* a "stripped down lint library source
file", it's a *binary* "lint" library file.  As Larry McVoy (who was
recently in hand-to-hand combat with "lint" libraries) notes, having the
stripped-down source files are handy, because when "lint" complains
about a parameter mismatch between line XXX of YYY.c and line NNN of
llib-ZZZ, you can go look at line NNN of llib-ZZZ (that being the
stripped-down "lint" library source file) and see what parameters the
routine expects.

kent@sparky.IMD.Sterling.COM (Kent Landfield) (11/01/90)

In article <4212@auspex.auspex.com> guy@auspex.auspex.com (Guy Harris) writes:
>
> >   However, there are no flags (or combinations of same) which
> >   seem to result in the production of said "stripped down lint
> >   library source files".
>
>...
>
> >From the lint manual page:
> >
> >	-Clibrary
> >		Create a lint library with the name llib-llibrary.ln.
> >
> >Also, -i will generate a .ln file with just the routines and the call
> >lines.
>
>llib-ZZZ, you can go look at line NNN of llib-ZZZ (that being the
>stripped-down "lint" library source file) and see what parameters the
>routine expects.

The following script makes the looking easier. It's a simple
tool but quite useful.

			-Kent+

------------------------ lhelp ---------------------------
#!/bin/sh
#
#  lhelp
#
#     Kent Landfield  
#    
#     This script is used to get the parameters a routine needs 
#     to be called with. This is set up for SunOS. If you are not
#     on a Sun, change the LINT_LIBS and L to reflect your systems
#     lint library configuration.
#
#     If you have lint libraries that you have developed for 
#     your projects, fill in PROJECT with the appropriate paths.
#
#     Note: It is best to have the entire definition on a single line..
#	int draw_box(x1,y1,x2,y2) short x1,y1,x2,y2; { return(0); }
#
L=/usr/lib/lint
LINT_LIBS="$L/llib-lc $L/llib-lcgi $L/llib-lcore $L/llib-lcurses \
	$L/llib-lkvm $L/llib-llwp $L/llib-lm $L/llib-lmp \
	$L/llib-lpixrect $L/llib-lplot $L/llib-lsuntool $L/llib-lsunwindow \
	$L/llib-ltermcap"

PROJECT_LINTLIBS=""

case $# in
	0) echo "usage: $0 libfunction ..."; exit 1;;
	*) ;;
esac
while [ "$1" != "" ]
do
	for lib in $LINT_LIBS $PROJECT_LINTLIBS
	do
		entry=`grep $1 $lib`
		if [ "$entry" != "" ]
		then
			echo "$lib"
			echo "$entry"
		fi
	done
	if [ "$2" != "" ]
	then
		echo
	fi
	shift
done
-- 
Kent Landfield                       INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD               UUCP:     uunet!sparky!kent
1404 Ft. Crook Rd. South             Phone:    (402) 291-8300 
Bellevue, NE. 68005-2969             FAX:      (402) 291-4362