[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: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes |
Date: |
Mon, 11 Aug 2008 16:56:36 +0200 |
Le lundi 11 août 2008 à 17:48 +0300, Avi Kivity a écrit :
> Anthony Liguori wrote:
> > Blue Swirl wrote:
> >> On 8/9/08, Anthony Liguori <address@hidden> wrote:
> >>
> >>> Blue Swirl wrote:
> >>>
> >>>
> >>>> Hi,
> >>>>
> >>>> I made a series of patches that add -Wstrict-prototypes to the CFLAGS
> >>>> and then -Wmissing-prototypes, both of which are enabled by Xen. I
> >>>> also fixed most warnings generated -Wstrict-prototypes and some of
> >>>> them for the -Wmissing-prototypes case.
> >>>>
> >>>> Compiling with -Wstrict-prototypes produces only one extra warning. I
> >>>> think this flag should be enabled.
> >>>>
> >>>>
> >>>>
> >>> As long as the plan is to fix all of those warnings, I think it's a
> >>> good
> >>> idea.
> >>>
> >>
> >> The extra unfixed warning comes from monitor.c:
> >> typedef struct term_cmd_t {
> >> const char *name;
> >> const char *args_type;
> >> void (*handler)();
> >> const char *params;
> >> const char *help;
> >> } term_cmd_t;
> >>
> >> The warning is generated because the definition of "handler" should
> >> also describe the parameters and not use the old () style. But in this
> >> case, they can vary:
> >>
> >
> > You could just switch void (*handler)() to void *handler.
>
> Function pointers might be wider than data pointers.
>
> Looking at the usage, though, it looks like the best thing is to have a
>
> void (*handler)(const char **args)
>
> So we pass the array of arguments (could be zero length) to the handler.
I agree with that.
Each command can be seen like a shell command and "handler" is like the
"int main(int argc, char **argv)".
Perhaps we can have an "int (*handler)(int argc, char **argv)" ?
Regards,
Laurent
--
----------------- address@hidden ------------------
"La perfection est atteinte non quand il ne reste rien à
ajouter mais quand il ne reste rien à enlever." Saint Exupéry
- [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Blue Swirl, 2008/08/08
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Anthony Liguori, 2008/08/09
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Blue Swirl, 2008/08/10
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Gerd Hoffmann, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, Samuel Thibault, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, M. Warner Losh, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes, M. Warner Losh, 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, Paul Brook, 2008/08/11
- Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes,
Laurent Vivier <=
- 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, 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, Laurent Vivier, 2008/08/12