From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGlOC-0005YR-RD for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:28:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YGlO2-0004EY-Dr for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:27:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35724) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YGlO2-0004E8-5H for qemu-devel@nongnu.org; Thu, 29 Jan 2015 04:27:42 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t0T9Rf50004729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Thu, 29 Jan 2015 04:27:41 -0500 From: Markus Armbruster Date: Thu, 29 Jan 2015 10:27:33 +0100 Message-Id: <1422523658-3503-5-git-send-email-armbru@redhat.com> In-Reply-To: <1422523658-3503-1-git-send-email-armbru@redhat.com> References: <1422523658-3503-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v2 4/9] qmp: Clean up qmp_query_spice() #ifndef !CONFIG_SPICE dummy List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kraxel@redhat.com, lcapitulino@redhat.com QMP command query-spice exists only #ifdef CONFIG_SPICE. Due to QAPI limitations, we need a dummy function anyway, but it's unreachable. Our current dummy function goes out of its way to produce the exact same error as the QMP core does for unknown commands. Cute, but both unclean and unnecessary. Replace by straight abort(). Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake Reviewed-by: Gerd Hoffmann --- qmp.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/qmp.c b/qmp.c index ef155ff..7f2d25a 100644 --- a/qmp.c +++ b/qmp.c @@ -137,14 +137,18 @@ VncInfo *qmp_query_vnc(Error **errp) #endif #ifndef CONFIG_SPICE -/* If SPICE support is enabled, the "true" query-spice command is - defined in the SPICE subsystem. Also note that we use a small - trick to maintain query-spice's original behavior, which is not - to be available in the namespace if SPICE is not compiled in */ +/* + * qmp-commands.hx ensures that QMP command query-spice exists only + * #ifdef CONFIG_SPICE. Necessary for an accurate query-commands + * result. However, the QAPI schema is blissfully unaware of that, + * and the QAPI code generator happily generates a dead + * qmp_marshal_input_query_spice() that calls qmp_query_spice(). + * Provide it one, or else linking fails. + * FIXME Educate the QAPI schema on CONFIG_SPICE. + */ SpiceInfo *qmp_query_spice(Error **errp) { - error_set(errp, QERR_COMMAND_NOT_FOUND, "query-spice"); - return NULL; + abort(); }; #endif -- 1.9.3