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 C compiler mishandles uses of functions of type void (with fix) Message-ID: <5067@elsie.UUCP> Date: Sat, 23-Feb-85 11:55:13 EST Article-I.D.: elsie.5067 Posted: Sat Feb 23 11:55:13 1985 Date-Received: Wed, 27-Feb-85 04:01:07 EST Organization: NIH-LEC, Bethesda, MD Lines: 47 Index: lib/mip/trees.c Fix Description: The C compiler can't compile some statements that take the address of a function of type void. Repeat-By: echo "extern void subr(); void (* ptr)() = subr;" > try.c cc -c try.c An error message is produced and "try.o" is not created. Fix: Most of the fix is to ensure that when the "-p" option is used with "lint" it will produce appropriate warnings. The file is named "/usr/src/cmd/mip/trees.c" in 4.1bsd. The trade secret status of the code precludes a clearer posting. ed lib/mip/trees.c /^moditype/;/case TVOID/a #ifndef OLDVERSION return MPTR; #endif . /^opact/;/case GE/a #ifndef OLDVERSION if (pflag && (mt1 == MPTR || mt2 == MPTR)) werror("pre-'85 BSD compilers can't take address of function of type void"); #endif . /^opact/;/case COLON/a #ifndef OLDVERSION if (pflag && (mt1 == MPTR || mt2 == MPTR)) werror("pre-'85 BSD compilers can't take address of function of type void"); #endif . /^opact/;/case CAST/a #ifndef OLDVERSION if (pflag && (mt1 == MPTR || mt2 == MPTR)) werror("pre-'85 BSD compilers can't take address of function of type void"); #endif . w q -- UUCP: ..decvax!seismo!elsie!ado ARPA: elsie!ado@seismo.ARPA DEC, VAX and Elsie are Digital Equipment and Borden trademarks