qapi-event: Eliminate global variable event_enum_value

Backports commit 7b24626cd019ed5084c8e3370999176a1ebd44be from qemu
This commit is contained in:
Markus Armbruster 2018-02-19 17:11:58 -05:00 committed by Lioncash
parent 782a549898
commit 533bf08ff1
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7
2 changed files with 4 additions and 2 deletions

View file

@ -137,7 +137,7 @@ def generate_event_implement(api_name, event_name, params):
emit(%(event_enum_value)s, qmp, &local_err);
""",
event_enum_value = event_enum_value)
event_enum_value = c_enum_const(event_enum_name, event_name))
# step 5: clean up
if params:
@ -222,7 +222,6 @@ for expr in exprs:
fdecl.write(ret)
# We need an enum value per event
event_enum_value = c_enum_const(event_enum_name, event_name)
ret = generate_event_implement(api_name, event_name, params)
fdef.write(ret)

View file

@ -1506,6 +1506,9 @@ const char *const %(name)s_lookup[] = {
''',
index = index, value = value)
# Unicorn: We don't use C99 [ARRAY_INDICING] = Thing because
# MSVC is still in the stone-age with this part of C compiler
# support.
max_index = c_enum_const(name, 'MAX', prefix)
ret += mcgen('''
NULL,