qapi: Add 'if' to implicit struct members

The generated code is for now *unconditional*.  Later patches generate
the conditionals.

Note that union discriminators may not have 'if' conditionals.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20181213123724.4866-14-marcandre.lureau@redhat.com>
Message-Id: <20181213123724.4866-15-marcandre.lureau@redhat.com>
[Patches squashed, commit message tweaked]
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-12-13 16:37:15 +04:00 committed by Markus Armbruster
parent 87adbbffd4
commit ccadd6bcba
10 changed files with 56 additions and 10 deletions

View file

@ -752,6 +752,16 @@ gets its generated code guarded like this:
#endif /* defined(HAVE_BAR) */
#endif /* defined(CONFIG_FOO) */
Where a member can be defined with a single string value for its type,
it is also possible to supply a dictionary instead with both 'type'
and 'if' keys. (TODO: union and alternate)
Example: a conditional 'bar' member
{ 'struct': 'IfStruct', 'data':
{ 'foo': 'int',
'bar': { 'type': 'int', 'if': 'defined(IFCOND)'} } }
An enum value can be replaced by a dictionary with a 'name' and a 'if'
key.