4.?bsd C compiler mishandles uses of functions of type void (with fix)

Arthur David Olson ado at elsie.UUCP
Sun Feb 24 02:55:13 AEST 1985


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 at seismo.ARPA
	DEC, VAX and Elsie are Digital Equipment and Borden trademarks



More information about the Comp.bugs.4bsd.ucb-fixes mailing list