@@ -50,7 +50,8 @@ void qtest_quit(QTestState *s);
/**
* qtest_qmp_discard_response:
* @s: #QTestState instance to operate on.
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and consumes the response.
*/
@@ -59,7 +60,8 @@ void qtest_qmp_discard_response(QTestState *s, const char *fmt, ...);
/**
* qtest_qmp:
* @s: #QTestState instance to operate on.
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and returns the response.
*/
@@ -68,7 +70,8 @@ QDict *qtest_qmp(QTestState *s, const char *fmt, ...);
/**
* qtest_async_qmp:
* @s: #QTestState instance to operate on.
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
@@ -134,7 +137,7 @@ QDict *qtest_qmp_eventwait_ref(QTestState *s, const char *event);
/**
* qtest_hmp:
* @s: #QTestState instance to operate on.
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, formats arguments like vsprintf().
*
* Send HMP command to QEMU via QMP's human-monitor-command.
* QMP events are discarded.
@@ -535,7 +538,8 @@ static inline void qtest_end(void)
/**
* qmp:
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and returns the response.
*/
@@ -543,7 +547,8 @@ QDict *qmp(const char *fmt, ...);
/**
* qmp_async:
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and leaves the response in the stream.
*/
@@ -551,7 +556,8 @@ void qmp_async(const char *fmt, ...);
/**
* qmp_discard_response:
- * @fmt...: QMP message to send to qemu
+ * @fmt...: QMP message to send to qemu; formats arguments through
+ * json-lexer.c (only understands '%((l|ll|I64)?d|[ipsf])').
*
* Sends a QMP message to QEMU and consumes the response.
*/
@@ -592,7 +598,7 @@ static inline QDict *qmp_eventwait_ref(const char *event)
/**
* hmp:
- * @fmt...: HMP command to send to QEMU
+ * @fmt...: HMP command to send to QEMU, formats arguments like vsprintf().
*
* Send HMP command to QEMU via QMP's human-monitor-command.
*
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. However, qmp() (and friends) only accept a subset of printf flags look-alikes (namely, those that our JSON parser understands), and what is worse, qmp("true") (the JSON keyword 'true') is different from qmp("%s", "true") (the JSON string '"true"'), so marking those as printf-like would produce more harm from bogus warnings than it helps (we may have made a mistake in previously marking qobject_from_jsonf(), but this patch is not addressing that). Signed-off-by: Eric Blake <eblake@redhat.com> --- v2: several comment tweaks, explain why qmp() can't be marked --- tests/libqtest.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-)