[net.lang.c] Use of lint

brett@wjvax.UUCP (Brett Galloway) (08/15/86)

I am currently working on some software in which I have created a number
of object libraries, and then I use those libraries to create my executables.

My question is how to use lint in an effective manner with these libraries,
on a 4.2 BSD system.  I would like to perform two tasks with lint.  First, I
would like to generate from each library directory a lint library for the
use of the higher-level libraries and top-level source.  Second, I would
like to run lint on the source files in each library and on the top-level
source files using the relevant lint libraries.  Therefore, I tried the
following construction in my makefile: (edited)

	CFILES=		<list of .c files in the library>
	LIBMISCname=	MISC
	LLIBMISC=	../llib-l$(LIBMISCname).ln
	LLIBS=		../llib-lGENERAL.ln <more lint libraries>
	LINT=		lint -I../../include -DLINT

	$(LLIBMISC):	$(CFILES)
		$(LINT) -C$(LIBMISCname) $? $(LLIBMISC)	[1]
		$(LINT) -h $(CFILES) $(LLIBS)		[2]
		@mv llib-l$(LIBMISCname).ln $(LLIBMISC)	[3]

The first line ([1]) supposedly lints the C source files that are out of date
together with the current lint library and drops a new library llib-lMISC.ln,
which I move onto the real lint library at the end (line [3]).

The second line ([2]) supposedly lints ALL the source files (since a change to
a given source file may make other unchanged C files fail which formerly
passed) together with the other relevant lint libraries.

My first question is whether my construction is correct and performs (in
the best way) what I want to do.

My second question concerns one incidental failure of this method.  My lint
documentation says that the standard C library is checked by default.  Yet
when I use this makefile for one particular library, I get complaints for the
following:

	Variable number of arguments in fprintf()
	Variable _iob used but not defined
	Variable errno used but not defined
	Variable _ctype_ used but not defined

Yet when I read /usr/lib/lint/llib-lc (the human-readable form of the standard
C lint library), I find definitions for _iob, errno, and _ctype_; and
fprintf() is declared as /*VARARGS*/.  Why, then, is lint complaining?

-------------
Brett Galloway
{pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett
-- 
-------------
Brett Galloway
{pesnta,twg,ios,qubix,turtlevax,tymix,vecpyr,certes,isi}!wjvax!brett

ireland@ALMSA-1.ARPA (Mike Ireland) (08/26/86)

A better fix for the bug in /usr/bin/lint might be to skip include libraries
in the first case statement, i.e.:

	-l*)	;;
	-*n*)	P= ;;
	-*p*)	P=port ;;

This fix does not require any change in specifying switches and will allow an
n or p in an include library name.

	-Mike.
-- 
Mike Ireland     <ireland@almsa-1.arpa>       ..!seismo!ireland@almsa-1.arpa
USAMC ALMSA, Box 1578, St. Louis, MO  63188-1578      (314) 263-5118, AV 693