Skip to content

Commit

Permalink
Adjust qapi-visit for python-2.4.3
Browse files Browse the repository at this point in the history
We say we support python 2.4, but python 2.4.3 does not
support the "expr if test else expr" syntax used here.

This allows QEMU to compile on RHEL 5.3, the last release for ia64.

Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Michael Roth <[email protected]>
Signed-off-by: Luiz Capitulino <[email protected]>
  • Loading branch information
rth7680 authored and Luiz Capitulino committed Nov 11, 2013
1 parent 964668b commit 7b75d9d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions scripts/qapi-visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
def generate_visit_struct_fields(name, field_prefix, fn_prefix, members, base = None):
substructs = []
ret = ''
full_name = name if not fn_prefix else "%s_%s" % (name, fn_prefix)
if not fn_prefix:
full_name = name
else:
full_name = "%s_%s" % (name, fn_prefix)

for argname, argentry, optional, structured in parse_args(members):
if structured:
Expand Down Expand Up @@ -97,7 +100,10 @@ def generate_visit_struct_body(field_prefix, name, members):
''')
push_indent()

full_name = name if not field_prefix else "%s_%s" % (field_prefix, name)
if not field_prefix:
full_name = name
else:
full_name = "%s_%s" % (field_prefix, name)

if len(field_prefix):
ret += mcgen('''
Expand Down Expand Up @@ -283,12 +289,17 @@ def generate_visit_union(expr):
name=name)

pop_indent()

if not discriminator:
desc_type = "type"
else:
desc_type = discriminator
ret += mcgen('''
visit_type_%(name)sKind(m, &(*obj)->kind, "%(type)s", &err);
if (!err) {
switch ((*obj)->kind) {
''',
name=name, type="type" if not discriminator else discriminator)
name=name, type=desc_type)

for key in members:
if not discriminator:
Expand Down

0 comments on commit 7b75d9d

Please sign in to comment.