提交 303b54b1 编写于 作者: L Luiz Capitulino

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: NLuiz Capitulino <lcapitulino@redhat.com>
上级 d2a80d6b
......@@ -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,
''',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册