qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmis


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes
Date: Mon, 11 Aug 2008 09:52:03 +0200
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

Blue Swirl wrote:
> On 8/9/08, Anthony Liguori <address@hidden> wrote:
>>  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:
> static void do_help(const char *name)
> static void do_quit(void)
[ ... ]

> I don't have a good plan how to fix this, proposals are welcome.
> Changing all handlers to use va_args to just silence a gcc warning
> sounds like overkill.

Using a union maybe?

typedef struct term_cmd_t {
      [ ... ]
      union {
          void (*help)(const char name);
          void (*quit)(void);
          [ ... ]
     } handlers;
     [ ... ]
};

cheers,
  Gerd


-- 
http://kraxel.fedorapeople.org/xenner/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]