4.?BSD lint muffs enum pointer arguments (with fix)
Arthur David Olson
ado at elsie.UUCP
Sat Nov 23 05:30:03 AEST 1985
Index: cmd/mip/optim.c Fix
Description:
4.?BSD lint gives bogus diagnostics for enum pointer arguments.
Repeat-By:
Create a file named "try.c" with these lines in it:
enum foo {a,b,c};
try(bar)
enum foo * bar;
{
try(bar);
}
Then use the command
lint try.c
and note the output:
try, arg. 1 used inconsistently try.c(5) :: try.c(6)
Fix:
The problem occurs because pass 1 of the C compiler changes pointers
to enums to other ilks of pointers; while this simplifies code
generation for the compiler, it messes up "lint"s efforts to check
types. The fix is to conditionalize a line of code in "optim.c".
Here's the line from "optim.c" involved; the trade secret status of
the code involved precludes a clearer posting.
#ifdef OLDVERSION
if( (t=BTYPE(p->in.type))==ENUMTY || t==MOETY ) econvert(p);
#else
#ifndef LINT
if( (t=BTYPE(p->in.type))==ENUMTY || t==MOETY ) econvert(p);
#endif
#endif
--
Lint is an Oscar Madison trademark.
Bugs is a Warner Brothers trademark.
--
UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado at seismo.ARPA
DEC, VAX and Elsie are Digital Equipment and Borden trademarks
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list