From 533bf08ff119e4f863f13c94312da1972dd959b7 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 19 Feb 2018 17:11:58 -0500 Subject: [PATCH] qapi-event: Eliminate global variable event_enum_value Backports commit 7b24626cd019ed5084c8e3370999176a1ebd44be from qemu --- qemu/scripts/qapi-event.py | 3 +-- qemu/scripts/qapi.py | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/qemu/scripts/qapi-event.py b/qemu/scripts/qapi-event.py index df9b80e7..c44f7815 100644 --- a/qemu/scripts/qapi-event.py +++ b/qemu/scripts/qapi-event.py @@ -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) diff --git a/qemu/scripts/qapi.py b/qemu/scripts/qapi.py index a1650d26..2651656a 100644 --- a/qemu/scripts/qapi.py +++ b/qemu/scripts/qapi.py @@ -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,