mirror of
https://github.com/Motorhead1991/qemu.git
synced 2026-01-24 14:16:41 -07:00
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:
parent
87adbbffd4
commit
ccadd6bcba
10 changed files with 56 additions and 10 deletions
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue