[PATCH] Updated Legacy code in i386 pc386

Peter Dufault dufault at hda.com
Wed Jul 24 12:29:15 UTC 2013


On Jul 24, 2013, at 08:11 , Vipul Nayyar <nayyar_vipul at yahoo.com> wrote:

> Hello Peter,
> 
> Thanks for the heads up. I put the cast their initially because the compiler gave me a warning that interrupt handler install function argument 4 requires a rtems_interrupt_handler type. 
> 
> So can you tell me, what is the right way to go about this ? What kind of problems can be caused ? How do I make sure that I'm actually fixing that part of code ?
> 


It varies from case to case.  For warnings about a function mismatch I usually introduce a "shim" function in preference to casting, for example, the prototype for a pthread function is
"void *handler(void *);"  so to call "void fred(void)" I might add a call_fred() shim:

static void *call_fred(void *unused) {
	fred();
	return (void *)0;
}

I try to only pass opaque type pointers via a void * and not some other unknown type.

For variables I'll introduce a temporary. Obviously you never want to cast a pointer to an integer to be a pointer to a double to silence a cast.

etc.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20130724/0e9ea107/attachment-0001.html>


More information about the devel mailing list