Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site elsie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!houxz!vax135!cornell!uw-beaver!tektronix!hplabs!hao!seismo!rlgvax!cvl!elsie!ado From: ado@elsie.UUCP Newsgroups: net.bugs.4bsd Subject: "lint -h" misses constants in conditional contexts (w/changes) Message-ID: <1115@elsie.UUCP> Date: Fri, 20-Jul-84 14:20:59 EDT Article-I.D.: elsie.1115 Posted: Fri Jul 20 14:20:59 1984 Date-Received: Mon, 23-Jul-84 01:42:33 EDT Organization: NIH-LEC, Bethesda, MD Lines: 48 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)