Marc-André Lureau <marcandre.lur...@redhat.com> writes: > Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> > --- > scripts/qapi.py | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/scripts/qapi.py b/scripts/qapi.py > index 9c7c01c11d..201e425842 100644 > --- a/scripts/qapi.py > +++ b/scripts/qapi.py > @@ -1967,13 +1967,16 @@ static const char *const %(c_name)s_array[] = { > ''', > c_name=c_name(name)) > for value in values: > + ifcond = None
I hoped I would see this line in a later patch when I asked for it in my review of the previous patch :) > if isinstance(value, tuple): > value, ifcond = value > + ret += gen_if(ifcond) > index = c_enum_const(name, value, prefix) > ret += mcgen(''' > [%(index)s] = "%(value)s", > ''', > index=index, value=value) > + ret += gen_endif(ifcond) > > max_index = c_enum_const(name, '_MAX', prefix) > ret += mcgen(''' > @@ -1999,12 +2002,15 @@ typedef enum %(c_name)s { > c_name=c_name(name)) > > for value in enum_values: > + ifcond = None > if isinstance(value, tuple): > value, ifcond = value > + ret += gen_if(ifcond) > ret += mcgen(''' > %(c_enum)s, > ''', > c_enum=c_enum_const(name, value, prefix)) > + ret += gen_endif(ifcond) > > ret += mcgen(''' > } %(c_name)s;