Check the Arg Count
Donn Seeley
donn at utah-gr.UUCP
Fri Jan 9 08:07:25 AEST 1987
Brett Galloway complains:
... [Lint] provides the ability to create lint libraries.
Unfortunately, lint treats these libraries differently than cc
treats object libraries. It would be most useful for
maintaining large pieces of software if lint behaved the same
as cc -- lint'ing source files into some intermediate form,
finding all lint errors unique to that source file (this is
analogous to the compile cycle), and lint'ing the intermediate
lint files together to find global errors (this is analogous to
the load cycle). This would make lint easier to use,
especially from within makefiles. ...
Lint (under BSD Unix and probably most other varieties) works exactly
like cc, 'compiling' into an intermediate form and 'loading' the
result. You can read the lint shell (/usr/bin/lint) to find out more
about how lint works.
It's really simple to build big lint libraries using a makefile to
avoid re-linting individual source files. Try something like this:
------------------------------------------------------------------------
.SUFFIXES: .ln
.c.ln:
lint -CTEMP $(LINTFLAGS) $*.c
-mv llib-lTEMP.ln $@
CPPFLAGS= -DDEBUG
LINTFLAGS= -h $(CPPFLAGS)
CFLAGS= -g $(CPPFLAGS)
OBJECTS= fu.o bar.o
LINTINTS= fu.ln bar.ln
all: libfubar.a llib-lfubar.ln
libfubar.a: $(OBJECTS)
ar crv libfubar.a $(OBJECTS)
llib-lfubar.ln: $(LINTINTS)
cat $(LINTINTS) > llib-lfubar.ln
------------------------------------------------------------------------
This example causes lint files to be produced independently of object
files; if you so desired, you could change the '.c.o' rule
appropriately so that lint is always run when a file is recompiled.
Note that for a program rather than a library, you might write a
makefile line like 'lintall:; lint $(LINTFLAGS) $(LINTINTS)' instead
of using 'cat' to build a library.
Donn Seeley University of Utah CS Dept donn at cs.utah.edu
40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn
More information about the Comp.lang.c
mailing list