Couple of bugs
Christian Ludlam
christian at recoil.org
Sat Sep 22 14:00:26 BST 2007
On 21 Sep Tom Hughes wrote:
> In message <e5d2bd254f.Jo at hobbes.bass-software.com>
> John Tytgat <John.Tytgat at aaug.net> wrote:
>
> > It does. The "function" type is also used in the PCI swi interface file
> > but it is not clear to me if this is the same APCS interface as for
> > DragAnAobject swi.
>
> The problem is that DefMod doesn't have a syntax to fully describe
> functions and their arguments so it can't spit out a proper prototype
> and instead the function type in DefMod is just mapped to void * in
> the C output I think.
>
> A lot of the function points taken by SWIs are not very amenable to
> being represented as C prototypes anyway I suspect...
I don't think it would need to describe the prototype fully - currently you
need to cast your function, but even with an EXPLICIT cast Norcroft gives you
a "cast between function and non-function types" warning.
If it was prototyped as "void (*)(void)" then you'd still need the cast, but
you'd get rid of the warning.
I did this when I modified DefMod to generate veneers to let me build Zap
modes in C. The code changed (in cheader.c)
case def_TYPE_ASM:
if ((rc = fprintf (file, "void %s", v)) < 0)
goto finish; /*v != NULL*/
break;
into this:
case def_TYPE_ASM:
if ((rc = fprintf (file, "void (*%s)(void)", v)) < 0)
goto finish; /*v != NULL*/
break;
We'd probably need to go through all the swi files that use .Asm and check
that they really do mean function pointers, and not just (void *).
--
Christian Ludlam
christian at recoil.org
More information about the oslib-user
mailing list