projects
/
qemu.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2a80d6
)
qapi: Automatically generate a _MAX value for enums
author
Luiz Capitulino
<lcapitulino@redhat.com>
Fri, 30 Sep 2011 15:43:27 +0000
(12:43 -0300)
committer
Luiz Capitulino
<lcapitulino@redhat.com>
Tue, 4 Oct 2011 14:00:47 +0000
(11:00 -0300)
It's the last value in the enum and is very useful for the C
implementation.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
scripts/qapi-types.py
patch
|
blob
|
history
diff --git
a/scripts/qapi-types.py
b/scripts/qapi-types.py
index 3bacc0c0da4de6e58b3b48707aee0209b3108e87..f64d84c39ea7ae7b6f5f60ef997e0a7ae9b9cc5f 100644
(file)
--- a/
scripts/qapi-types.py
+++ b/
scripts/qapi-types.py
@@
-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,
''',