mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 12:23:53 -06:00
qapi: Automatically generate a _MAX value for enums
It's the last value in the enum and is very useful for the C implementation. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
This commit is contained in:
parent
d2a80d6bb3
commit
303b54b1a2
1 changed files with 4 additions and 1 deletions
|
@ -91,8 +91,11 @@ typedef enum %(name)s
|
|||
''',
|
||||
name=name)
|
||||
|
||||
# append automatically generated _MAX value
|
||||
enum_values = values + [ 'MAX' ]
|
||||
|
||||
i = 0
|
||||
for value in values:
|
||||
for value in enum_values:
|
||||
enum_decl += mcgen('''
|
||||
%(abbrev)s_%(value)s = %(i)d,
|
||||
''',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue