mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-03-24 22:15:07 +00:00
qapi-visit: Fix two name arguments passed to visitors
The generated code passes mangled schema names to visit_type_enum() and union's visit_start_struct(). Fix it to pass the names unadulterated, like we do everywhere else. Only qapi-schema-test.json actually has names where this makes a difference: enum __org.qemu_x-Enum, flat union __org.qemu_x-Union2, simple union __org.qemu_x-Union1 and its implicit enum __org.qemu_x-Union1Kind. Backports commit 40b3adec13a9e022ff5a2e2b81c243fc0a026746 from qemu
This commit is contained in:
parent
54ce4b3f00
commit
94b19608af
|
@ -186,12 +186,12 @@ out:
|
||||||
def generate_visit_enum(name):
|
def generate_visit_enum(name):
|
||||||
return mcgen('''
|
return mcgen('''
|
||||||
|
|
||||||
void visit_type_%(name)s(Visitor *m, %(name)s *obj, const char *name, Error **errp)
|
void visit_type_%(c_name)s(Visitor *m, %(c_name)s *obj, const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
visit_type_enum(m, (int *)obj, %(name)s_lookup, "%(name)s", name, errp);
|
visit_type_enum(m, (int *)obj, %(c_name)s_lookup, "%(name)s", name, errp);
|
||||||
}
|
}
|
||||||
''',
|
''',
|
||||||
name=c_name(name))
|
c_name=c_name(name), name=name)
|
||||||
|
|
||||||
def generate_visit_alternate(name, members):
|
def generate_visit_alternate(name, members):
|
||||||
ret = mcgen('''
|
ret = mcgen('''
|
||||||
|
@ -279,17 +279,17 @@ def generate_visit_union(expr):
|
||||||
|
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
|
|
||||||
void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **errp)
|
void visit_type_%(c_name)s(Visitor *m, %(c_name)s **obj, const char *name, Error **errp)
|
||||||
{
|
{
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
|
||||||
visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err);
|
visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(c_name)s), &err);
|
||||||
if (err) {
|
if (err) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (*obj) {
|
if (*obj) {
|
||||||
''',
|
''',
|
||||||
name=c_name(name))
|
c_name=c_name(name), name=name)
|
||||||
|
|
||||||
if base:
|
if base:
|
||||||
ret += mcgen('''
|
ret += mcgen('''
|
||||||
|
|
Loading…
Reference in a new issue