Lint is your friend?

Duane Voth duanev at mcc.com
Wed Jun 13 08:00:26 AEST 1990


>From article <6207 at brazos.Rice.edu>, by auspex!guy at uunet.uu.net (Guy Harris):
> As soon as I saw "SPARC" and "semaphore", the neurons devoted to
> remembering that certain illegal C constructs involving passing members of
> unions to routines expecting the unions themselves started frantically
> firing...
> ...
> "lint" is your friend; it points this out when run against your program:
>
>     semctl, arg. 4 used inconsistently        llib-lc(149)  ::  foo.c(38)

Well, I'm having a bit of an emotional reaction to "lint is my friend".  I
would very much like to use the services of lint but I have a bit of a
problem with wading through hundreds of lines of warnings about problems I
don't care about, hunting for occasional lines like the one above.  Does
anyone know of tricks that can be used to selectively shut lint up about
certain problems?

For example; malloc() et.al. return char * but guarantees alignment of
memory to a boundary compatible with the largest supported compiler data
type.  This causes SPARC lint checking code to warn about "possible
pointer alignment problem" when there isn't any possible alignment
problem.  Lint's pass 2 also produces an "arg. n used inconsistently"
message for every *alloc call making it even harder to spot real problems
like the above.  Call *alloc enough times in your program and lint becomes
real obnoxious.

Is there any help for those of us with good intentions?

duane voth                                         duanev at mcc.com
{uunet,harvard,gatech,pyramid}!cs.utexas.edu!milano!pp!duanev



More information about the Comp.sys.sun mailing list