[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmis
From: |
Anthony Liguori |
Subject: |
Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes |
Date: |
Mon, 11 Aug 2008 14:22:16 -0500 |
User-agent: |
Thunderbird 2.0.0.16 (X11/20080723) |
Laurent Vivier wrote:
I vote for this. The other solutions do not improve type safety
(except for union) and they are more complex.
But I think to call the function you have to cast the pointer, this
doesn't improve type safety too...
Right now, the monitor works by taking a generic function pointer "void
(*)()" which is treated specially by the C standard (although it's now
deprecated). Any function pointer can be cast to a generic function
pointer. The dispatch loop basically looks like:
void dispatch(void (*func)(), int n_args, void *args)
{
switch (n_args) {
case 1:
((void (*)(void *))func)(args[0]); break;
case 1:
((void (*)(void *, void *))func)(args[0]); break;
...
}
But this tosses a warning since void (*)() is deprecated. So, if we use:
void dispatch(void *func, int n_args, void *args)
It'll work just like it did before.
Regards,
Anthony Liguori
Regards,
Laurent
----------------------- Laurent Vivier ----------------------
"The best way to predict the future is to invent it."
- Alan Kay
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, (continued)
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Anthony Liguori, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Avi Kivity, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Paul Brook, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Laurent Vivier, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Anthony Liguori, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Avi Kivity, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Anthony Liguori, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Blue Swirl, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Laurent Vivier, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Blue Swirl, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes,
Anthony Liguori <=
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Laurent Vivier, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Anthony Liguori, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Laurent Vivier, 2008/08/12
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Avi Kivity, 2008/08/12
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Daniel Jacobowitz, 2008/08/12