[M3commit] CVS Update: cm3

Jay Krell jkrell at elego.de
Fri Apr 12 11:02:21 CEST 2013


CVSROOT:	/usr/cvs
Changes by:	jkrell at birch.	13/04/12 11:02:21

Modified files:
	cm3/m3-sys/m3back/src/: M3C.m3 

Log message:
	working and much improved checkpoint
	
	get strong typing in by hook and by crook
	
	casting all functions to "untyped" didn't quite work, due to "noreturn"
	"untyped" is C: return_type (*)()
	C++: return_type (*)(...)
	a function pointer that accepts any parameters returns "return_type"
	
	void F1() noreturn;
	void F2() noreturn
	{
	F1();
	}
	=> ok
	
	void F1() noreturn;
	void F2() noreturn
	{
	((*)()F1)();
	}
	=> warning that noreturn function F2 returns.. error?
	(because casting the function to a pointer loses its no-returnedness).
	I tried not casting when calling an indirect function, but
	that doesn't work due to the types we do pass to such functions,
	even though there are very few of them.
	I maybe should have tried encoding no_return into the pointer type as needed.
	
	warnings aside, I think there was another problem.
	I forget what it was.
	
	So I bit the bullet and walk the parameter types of what
	I am calling (for direct calls) and use those types to cast all the parameters.
	This way we do have typeids and well typed struct pointers.
	
	Much to cleanup maybe..
	
	Esp. "type_text" => "type.text"
	Need to actually store all those types.
	And need get the stars for pointers for structs right. (they are currently correct)
	Maybe before that will pass structs by value using the C/C++ feature.
	But we can't because we pass structs by values to indirect function
	pointers when we haven't declared the type, apparently.
	That will simplify things for us.
	But maybe do it under #ifdef.
	Parameter stack needs to be expressions instead of text, so we
	can remove redundant casts.
	
	Need to review all the special casing and "TODO".




More information about the M3commit mailing list