[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 31/36] qtest: Document calling conventions
From: |
Eric Blake |
Subject: |
[Qemu-devel] [PATCH 31/36] qtest: Document calling conventions |
Date: |
Wed, 30 Nov 2016 13:44:49 -0600 |
We have two flavors of vararg usage in qtest; make it clear that
qmp() has different semantics than hmp(), and let the compiler
enforce that hmp() is used correctly. Since qmp() only accepts
exactly "%s" (asserting on misuse, which would be flagged during
'make check'), I figured that it is probably not worth adding a
format attribute to qmp() at this time.
Signed-off-by: Eric Blake <address@hidden>
---
tests/libqtest.h | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tests/libqtest.h b/tests/libqtest.h
index bab8d95..2ff3829 100644
--- a/tests/libqtest.h
+++ b/tests/libqtest.h
@@ -51,7 +51,7 @@ void qtest_qmp_discard_response(QTestState *s, const char
*json);
/**
* qtest_qmp:
* @s: #QTestState instance to operate on.
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; only recognizes "%s"
*
* Sends a QMP message to QEMU and returns the response.
*/
@@ -108,13 +108,13 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char
*event);
/**
* qtest_hmpv:
* @s: #QTestState instance to operate on.
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, passed through sprintf()
*
* Send HMP command to QEMU via QMP's human-monitor-command.
*
* Returns: the command's output. The caller should g_free() it.
*/
-char *qtest_hmp(QTestState *s, const char *fmt, ...);
+char *qtest_hmp(QTestState *s, const char *fmt, ...) GCC_FMT_ATTR(2, 3);
/**
* qtest_hmpv:
@@ -507,7 +507,7 @@ static inline void qtest_end(void)
/**
* qmp:
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; only recognizes "%s"
*
* Sends a QMP message to QEMU and returns the response.
*/
@@ -525,7 +525,7 @@ QDict *qmp_cmd(const char *cmd, QDict *args);
/**
* qmp_async:
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; only recognizes "%s"
*
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
@@ -584,13 +584,13 @@ static inline QDict *qmp_eventwait_ref(const char *event)
/**
* hmp:
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, passed through printf()
*
* Send HMP command to QEMU via QMP's human-monitor-command.
*
* Returns: the command's output. The caller should g_free() it.
*/
-char *hmp(const char *fmt, ...);
+char *hmp(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
/**
* get_irq:
--
2.7.4
- [Qemu-devel] [PATCH 20/36] qtest: Avoid dynamic JSON in device-introspect-test, (continued)
- [Qemu-devel] [PATCH 20/36] qtest: Avoid dynamic JSON in device-introspect-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 26/36] qtest: Drop unused qtest_qmp_async(), Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 21/36] qtest: Avoid dynamic JSON in tmp105-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 28/36] qapi: Factor out JSON string escaping, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 24/36] qtest: Drop unused qmp_fdv(), Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 27/36] qtest: Avoid dynamic JSON in qmp_cmd(), Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 18/36] qtest: Avoid dynamic JSON in fdc-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 33/36] qtest: Avoid dynamic JSON in test-x86-cpuid-compat, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 35/36] qapi: Rip out dynamic JSON parser escape sequence support, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 31/36] qtest: Document calling conventions,
Eric Blake <=
- [Qemu-devel] [PATCH 15/36] blockdev: Use simpler QAPI_TO_QOBJECT(), Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 34/36] qapi: Rip out dynamic JSON parser frontend, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 32/36] qtest: Avoid dynamic JSON in qom-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 17/36] qtest: Avoid dynamic JSON in ahci-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 36/36] qapi: Rip out dynamic JSON parser backend, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 02/36] qdict: Add convenience helpers for wrapped puts, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 23/36] qtest: Avoid dynamic JSON in virtio-blk-test, Eric Blake, 2016/11/30
- [Qemu-devel] [PATCH 30/36] qtest: Avoid dynamic JSON in qmp_fd_sendv(), Eric Blake, 2016/11/30