Subject: Re: Problems with lint(1)
To: None <tech-userlevel@NetBSD.ORG>
From: Christos Zoulas <christos@zoulas.com>
List: tech-userlevel
Date: 07/27/1998 17:21:58
In article <199807271630.MAA06866@lunacity.ne.mediaone.net> mycroft@mit.edu (Charles M. Hannum) writes:

>I'm observing some problems that make it difficult to use lint(1).
>I'll use vfscanf.c as an example, since most of the problems occur in
>it.

Yes, lint cen be a pain in the ass sometimes.

>1) It's incorrectly deciding that an expression is meaningless in some
>   cases:
>
>vfscanf.c(146): warning: expression has null effect
>
>                                nread++, fp->_r--, fp->_p++;

This can be fixed by altering the code to be { stmt; stmt; } instead of
stmt, stmt

>2) All uses of va_start() and va_arg() generate warnings:
>
>vfscanf.c(277): warning: possible pointer alignment problem
>vfscanf.c(277): warning: pointer casts may be troublesome
>
>                                *va_arg(ap, short *) = nread;

Well, changing the macro to "(type *)(void *) expr" from "(type *) expr"
should silence it.

>Can someone help fix these problems?

Older versions of lint were even worse...

christos