From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59173) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO3rc-0004b2-3F for qemu-devel@nongnu.org; Thu, 13 Mar 2014 07:31:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WO3ra-0000oK-Ow for qemu-devel@nongnu.org; Thu, 13 Mar 2014 07:31:52 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:46684) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WO3ra-0000o9-Hz for qemu-devel@nongnu.org; Thu, 13 Mar 2014 07:31:50 -0400 From: Peter Maydell Date: Thu, 13 Mar 2014 11:31:47 +0000 Message-Id: <1394710307-13187-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH] libqtest: Avoid inline varargs functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , patches@linaro.org Older versions of gcc (eg 4.6) can't handle varargs functions declared inline for anything other than completely trivial uses, and complain: tests/qom-test.c: In function 'qmp': tests/libqtest.h:359:60: sorry, unimplemented: function 'qmp' can never be inlined because it uses variable argument lists Avoid this problem by putting the functions into libqtest.c instead of using inline definitions in libqtest.h. Signed-off-by: Peter Maydell --- This doesn't bite us with the current libqtest code but the enhancements Andreas has in his QOM queue do trigger this gcc 4.6 unimplemented behaviour. tests/libqtest.c | 20 ++++++++++++++++++++ tests/libqtest.h | 20 ++------------------ 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/tests/libqtest.c b/tests/libqtest.c index f587d36..b69dfca 100644 --- a/tests/libqtest.c +++ b/tests/libqtest.c @@ -581,3 +581,23 @@ void qtest_memwrite(QTestState *s, uint64_t addr, const void *data, size_t size) qtest_sendf(s, "\n"); qtest_rsp(s, 0); } + +QDict *qmp(const char *fmt, ...) +{ + va_list ap; + QDict *response; + + va_start(ap, fmt); + response = qtest_qmpv(global_qtest, fmt, ap); + va_end(ap); + return response; +} + +void qmp_discard_response(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + qtest_qmpv_discard_response(global_qtest, fmt, ap); + va_end(ap); +} diff --git a/tests/libqtest.h b/tests/libqtest.h index 9deebdc..8268c09 100644 --- a/tests/libqtest.h +++ b/tests/libqtest.h @@ -356,16 +356,7 @@ static inline void qtest_end(void) * * Sends a QMP message to QEMU and returns the response. */ -static inline QDict *qmp(const char *fmt, ...) -{ - va_list ap; - QDict *response; - - va_start(ap, fmt); - response = qtest_qmpv(global_qtest, fmt, ap); - va_end(ap); - return response; -} +QDict *qmp(const char *fmt, ...); /** * qmp_discard_response: @@ -373,14 +364,7 @@ static inline QDict *qmp(const char *fmt, ...) * * Sends a QMP message to QEMU and consumes the response. */ -static inline void qmp_discard_response(const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - qtest_qmpv_discard_response(global_qtest, fmt, ap); - va_end(ap); -} +void qmp_discard_response(const char *fmt, ...); /** * get_irq: -- 1.9.0