Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/17/84; site elsie.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!seismo!umcp-cs!cvl!elsie!ado From: ado@elsie.UUCP (Arthur David Olson) Newsgroups: net.bugs.4bsd Subject: 4.?bsd cc and lint mistreat wild structure use (with fix) Message-ID: <5065@elsie.UUCP> Date: Thu, 21-Feb-85 11:23:32 EST Article-I.D.: elsie.5065 Posted: Thu Feb 21 11:23:32 1985 Date-Received: Tue, 26-Feb-85 05:39:16 EST References: <814@enea.UUCP> <1240@eagle.UUCP> <1997@wateng.UUCP> Organization: NIH-LEC, Bethesda, MD Lines: 63 > struct xy { > int x; > int y; > } a; > main() > { > struct xy *p; > p = &a; > if (*p) { > /* compiler error: zzzcode- bad type */ > } > } Index: lib/mip/trees.c Fix Description: The "cc" command gives cryptic messages when structures are used wildly; the "lint" command fails to give messages. Repeat-By: echo "struct { int x; } a; main() { a || a; }" > try.c cc try.c lint try.c Fix: The trade secret status of the code precludes a clearer posting. The file is named "/usr/src/cmd/mip/trees.c" in 4.1bsd. ed lib/mip/trees.c /^buildtree/;/OTHER/;/switch/a #ifndef OLDVERSION case QUEST: case CBRANCH: case ANDAND: case OROR: if (l->in.type == STRTY || l->in.type == UNIONTY || ((o == ANDAND || o == OROR) && (r->in.type == STRTY || r->in.type == UNIONTY))) uerror("wild use of structure or union"); break; #endif . /^opact/;/case CBRANCH/i #ifdef OLDVERSION . /return/a #else return 0; case CBRANCH: case ANDAND: case OROR: return OTHER; #endif /case QUEST/a #ifndef OLDVERSION return (mt2 & MENU) ? (TYPR + NCVTR + OTHER) : (TYPR + OTHER); #endif . w q -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks