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: M. Warner Losh
Subject: Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes
Date: Mon, 11 Aug 2008 07:30:42 -0600 (MDT)

In message: <address@hidden>
            Gerd Hoffmann <address@hidden> writes:
: 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;
:      [ ... ]
: };

Or just have all the commands use the same arguments?  That's usually
how this is done.  (*handler) should take a void *, which the callee
can do whatever it wants with...

Warner




reply via email to

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