From b73cf9e93f1c7fd6e949f71172c49848b4d70aa9 Mon Sep 17 00:00:00 2001 From: Andreas Färber Date: Sat, 16 Feb 2013 22:44:02 +0100 Subject: libqtest: Introduce qtest_qmpv() and convert remaining macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to convert qmp() macro to an inline function, expose a qtest_qmpv() function, reused by qtest_qmp(). We can't apply GCC_FMT_ATTR() since fdc-test is using zero-length format strings, which would result in warnings treated as errors. Signed-off-by: Andreas Färber Signed-off-by: Andreas Färber Message-id: 1361051043-27944-3-git-send-email-afaerber@suse.de Signed-off-by: Anthony Liguori --- tests/libqtest.h | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'tests/libqtest.h') diff --git a/tests/libqtest.h b/tests/libqtest.h index a111c9cddb..f5c6e21d45 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -17,6 +17,7 @@ #include #include +#include #include typedef struct QTestState QTestState; @@ -48,6 +49,16 @@ void qtest_quit(QTestState *s); */ void qtest_qmp(QTestState *s, const char *fmt, ...); +/** + * qtest_qmpv: + * @s: #QTestState instance to operate on. + * @fmt: QMP message to send to QEMU + * @ap: QMP message arguments + * + * Sends a QMP message to QEMU. + */ +void qtest_qmpv(QTestState *s, const char *fmt, va_list ap); + /** * qtest_get_irq: * @s: #QTestState instance to operate on. @@ -227,7 +238,14 @@ static inline QTestState *qtest_start(const char *args) * * Sends a QMP message to QEMU */ -#define qmp(fmt, ...) qtest_qmp(global_qtest, fmt, ## __VA_ARGS__) +static inline void qmp(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + qtest_qmpv(global_qtest, fmt, ap); + va_end(ap); +} /** * get_irq: -- cgit v1.2.3