diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2018-07-03 17:56:35 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2018-07-03 18:21:24 +0200 |
commit | 967c885108f18e5065744719f7959ba5ea0a5b0d (patch) | |
tree | b2138075fca0ddc4ca19454502ed0c376b8bc190 /tests/test-qmp-cmds.c | |
parent | b07cd3e748b3f27a17c27afeee578dc4eedb8dd5 (diff) |
qapi: add 'if' to top-level expressions
Accept 'if' key in top-level elements, accepted as string or list of
string type. The following patches will modify the test visitor to
check the value is correctly saved, and generate #if/#endif code (as a
single #if/endif line or a series for a list).
Example of 'if' key:
{ 'struct': 'TestIfStruct', 'data': { 'foo': 'int' },
'if': 'defined(TEST_IF_STRUCT)' }
The generated code is for now *unconditional*. Later patches generate
the conditionals.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20180703155648.11933-2-marcandre.lureau@redhat.com>
[Commit message and Documentation improved]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'tests/test-qmp-cmds.c')
-rw-r--r-- | tests/test-qmp-cmds.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/test-qmp-cmds.c b/tests/test-qmp-cmds.c index 491b0c4a44..840530b84c 100644 --- a/tests/test-qmp-cmds.c +++ b/tests/test-qmp-cmds.c @@ -12,6 +12,18 @@ static QmpCommandList qmp_commands; +/* #if defined(TEST_IF_STRUCT) && defined(TEST_IF_CMD) */ +UserDefThree *qmp_TestIfCmd(TestIfStruct *foo, Error **errp) +{ + return NULL; +} +/* #endif */ + +UserDefThree *qmp_TestCmdReturnDefThree(Error **errp) +{ + return NULL; +} + void qmp_user_def_cmd(Error **errp) { } |