diff options
author | Eric Blake <eblake@redhat.com> | 2015-05-14 06:50:57 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-05-14 18:21:13 +0200 |
commit | 83a02706bb1fd31c93eab755de543dfe228682d4 (patch) | |
tree | 2308a27e06b553170fe9b9d27beb5e3b9a0a67ed /scripts/qapi-visit.py | |
parent | fce384b8e5193e02421f6b2c2880f3684abcbdc0 (diff) |
qapi: Support downstream structs
Enhance the testsuite to cover downstream structs, including struct
members and base structs. Update the generator to mangle the
struct names in the appropriate places.
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Diffstat (limited to 'scripts/qapi-visit.py')
-rw-r--r-- | scripts/qapi-visit.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 7697ec65cc..b50072425e 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -56,7 +56,7 @@ static void visit_type_%(name)s_fields(Visitor *m, %(name)s **obj, Error **errp) { Error *err = NULL; ''', - name=name) + name=c_name(name)) push_indent() if base: @@ -111,16 +111,16 @@ def generate_visit_struct_body(name, members): ret = mcgen(''' 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 (*obj) { - visit_type_%(name)s_fields(m, obj, errp); + visit_type_%(c_name)s_fields(m, obj, errp); } visit_end_struct(m, &err); } error_propagate(errp, err); ''', - name=name) + name=name, c_name=c_name(name)) return ret @@ -137,7 +137,7 @@ def generate_visit_struct(expr): void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **errp) { ''', - name=name) + name=c_name(name)) ret += generate_visit_struct_body(name, members) @@ -347,6 +347,7 @@ out: def generate_declaration(name, members, builtin_type=False): ret = "" if not builtin_type: + name = c_name(name) ret += mcgen(''' void visit_type_%(name)s(Visitor *m, %(name)s **obj, const char *name, Error **errp); |