Subject: Re: Problems with lint(1)
To: Christos Zoulas <christos@zoulas.com>
From: Charles M. Hannum <mycroft@mit.edu>
List: tech-userlevel
Date: 07/28/1998 15:13:56
>In article <199807272009.QAA07630@jekyll.piermont.com> perry@piermont.com writes:
>>
>>Christos Zoulas writes:
>>> >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
>>
>>I'm sure this is a fine kludge, but shouldn't lint know that the other 
>>expression isn't "do nothing"?
>
>It knows that it does nothing, but it cannot determine if the author
>had intended it this way thus it produces a warning. 
>        (void) (expr, expr, expr);
>might get rid of the warning too, but it is ugly. In the case above,
>one does not even need the braces; substituting the commas with semicolons
>works fine.

Actually, that causes other problems; e.g. I might have to add braces
if a single `statement' in an if or else clause.

However, this is all moot, since I've fixed the bug in lint(1) (and
another one, too).

I think that fixes all the actual problems in lint(1) that I've run
into so far -- although it would be nice if it knew about
__attribute__((noreturn)).

There is still the varargs wart to deal with, and I noticed that
exports symbols in crt0 and libm are not defined anywhere, but it's
actually possible to build some lint-free code now.