Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KSXdu-0006oE-PV for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:41:02 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KSXdt-0006mz-Os for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:41:02 -0400 Received: from [199.232.76.173] (port=37679 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KSXdt-0006mk-Iu for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:41:01 -0400 Received: from bsdimp.com ([199.45.160.85]:54809 helo=harmony.bsdimp.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KSXds-0002vs-I7 for qemu-devel@nongnu.org; Mon, 11 Aug 2008 09:41:00 -0400 Date: Mon, 11 Aug 2008 07:30:42 -0600 (MDT) Message-Id: <20080811.073042.-399283255.imp@bsdimp.com> Subject: Re: [Qemu-devel] [RFC, PATCH] Add -Wstrict-prototypes, maybe later -Wmissing-prototypes From: "M. Warner Losh" In-Reply-To: <489FEFA3.3040105@redhat.com> References: <489DE0C7.9000505@codemonkey.ws> <489FEFA3.3040105@redhat.com> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kraxel@redhat.com In message: <489FEFA3.3040105@redhat.com> Gerd Hoffmann writes: : Blue Swirl wrote: : > On 8/9/08, Anthony Liguori 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