"lint -h" misses constants in conditional contexts (w/changes)
ado at elsie.UUCP
ado at elsie.UUCP
Sat Jul 21 04:20:59 AEST 1984
Index-- /usr/src/cmd/mip/trees.c /usr/src/cmd/mip/cgram.y
Description--
Use of lint's "-h" option misses some constants in conditional contexts.
Repeat by--
Pass this through "lint -h":
main()
{
if (0 + 1)
printf("true\n");
else printf("false\n");
printf((0 + 1) ? "true\n" : "false\n");
switch (0 + 1) {
case 0:
printf("false\n");
case 1:
printf("true\n");
}
}
Note that a diagnostic message is produced for line 3 only.
Fix--
ed - /usr/src/cmd/mip/trees.c
/QUEST.*ICON/a
#ifndef OLDVERSION
if( hflag ) werror( "constant in conditional context" );
#endif
.
w
q
ed - /usr/src/cmd/mip/cgram.y
/switchpart:/+2a
#ifndef OLDVERSION
if (hflag && ((union ndu *) $3)->in.op == ICON)
werror( "constant in conditional context" );
#endif
.
w
q
--
...decvax!allegra!umcp-cs!elsie!ado (301) 496-5688
(DEC, VAX and Elsie are Digital Equipment Corp. and Borden's trademarks)
More information about the Comp.bugs.4bsd.ucb-fixes
mailing list