From d28c6244c078535419238cd6b2ac47280976126f Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 21 Feb 2018 22:22:15 -0500 Subject: [PATCH] qapi: Rename 'fields' to 'members' in generated C code C types and JSON objects don't have fields, but members. We shouldn't gratuitously invent terminology. This patch is a strict renaming of static genarated functions, plus the naming of the dummy filler member for empty structs, before the next patch exposes some of that naming to the rest of the code base. Backports commit c81200b01422783cd29796ef4ccc275d05f9ce67 from qemu --- msvc/unicorn/qapi-visit.c | 8 ++++---- qemu/scripts/qapi-types.py | 2 +- qemu/scripts/qapi-visit.py | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/msvc/unicorn/qapi-visit.c b/msvc/unicorn/qapi-visit.c index 590db3d5..6cd3b0f0 100644 --- a/msvc/unicorn/qapi-visit.c +++ b/msvc/unicorn/qapi-visit.c @@ -16,7 +16,7 @@ #include "qemu-common.h" #include "qapi-visit.h" -static void visit_type_DummyForceArrays_fields(Visitor *v, DummyForceArrays *obj, Error **errp) +static void visit_type_DummyForceArrays_members(Visitor *v, DummyForceArrays *obj, Error **errp) { Error *err = NULL; @@ -40,7 +40,7 @@ void visit_type_DummyForceArrays(Visitor *v, const char *name, DummyForceArrays if (!*obj) { goto out_obj; } - visit_type_DummyForceArrays_fields(v, *obj, &err); + visit_type_DummyForceArrays_members(v, *obj, &err); error_propagate(errp, err); err = NULL; out_obj: @@ -63,7 +63,7 @@ void visit_type_QapiErrorClass(Visitor *v, const char *name, QapiErrorClass *obj *obj = value; } -static void visit_type_X86CPUFeatureWordInfo_fields(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp) +static void visit_type_X86CPUFeatureWordInfo_members(Visitor *v, X86CPUFeatureWordInfo *obj, Error **errp) { Error *err = NULL; @@ -101,7 +101,7 @@ void visit_type_X86CPUFeatureWordInfo(Visitor *v, const char *name, X86CPUFeatur if (!*obj) { goto out_obj; } - visit_type_X86CPUFeatureWordInfo_fields(v, *obj, &err); + visit_type_X86CPUFeatureWordInfo_members(v, *obj, &err); error_propagate(errp, err); err = NULL; out_obj: diff --git a/qemu/scripts/qapi-types.py b/qemu/scripts/qapi-types.py index 502b2d0a..d3f29d79 100644 --- a/qemu/scripts/qapi-types.py +++ b/qemu/scripts/qapi-types.py @@ -93,7 +93,7 @@ struct %(c_name)s { # struct is size 1). if not (base and base.members) and not members and not variants: ret += mcgen(''' - char qapi_dummy_field_for_empty_struct; + char qapi_dummy_for_empty_struct; ''') ret += mcgen(''' diff --git a/qemu/scripts/qapi-visit.py b/qemu/scripts/qapi-visit.py index 3d3146f6..f036849f 100644 --- a/qemu/scripts/qapi-visit.py +++ b/qemu/scripts/qapi-visit.py @@ -35,7 +35,7 @@ def gen_visit_members_decl(typ): object_members_seen.add(typ.name) return mcgen(''' -static void visit_type_%(c_type)s_fields(Visitor *v, %(c_type)s *obj, Error **errp); +static void visit_type_%(c_type)s_members(Visitor *v, %(c_type)s *obj, Error **errp); ''', c_type=typ.c_name()) @@ -54,7 +54,7 @@ def gen_visit_object_members(name, base, members, variants): object_members_seen.add(name) ret += mcgen(''' -static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **errp) +static void visit_type_%(c_name)s_members(Visitor *v, %(c_name)s *obj, Error **errp) { Error *err = NULL; @@ -63,7 +63,7 @@ static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **er if base: ret += mcgen(''' - visit_type_%(c_type)s_fields(v, (%(c_type)s *)obj, &err); + visit_type_%(c_type)s_members(v, (%(c_type)s *)obj, &err); ''', c_type=base.c_name()) ret += gen_err_check() @@ -93,7 +93,7 @@ static void visit_type_%(c_name)s_fields(Visitor *v, %(c_name)s *obj, Error **er c_name=c_name(var.name)) else: ret += mcgen(''' - visit_type_%(c_type)s_fields(v, &obj->u.%(c_name)s, &err); + visit_type_%(c_type)s_members(v, &obj->u.%(c_name)s, &err); ''', c_type=var.type.c_name(), c_name=c_name(var.name)) @@ -206,7 +206,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error if (err) { break; } - visit_type_%(c_type)s_fields(v, &(*obj)->u.%(c_name)s, &err); + visit_type_%(c_type)s_members(v, &(*obj)->u.%(c_name)s, &err); error_propagate(errp, err); err = NULL; visit_end_struct(v, &err); @@ -261,7 +261,7 @@ void visit_type_%(c_name)s(Visitor *v, const char *name, %(c_name)s **obj, Error if (!*obj) { goto out_obj; } - visit_type_%(c_name)s_fields(v, *obj, &err); + visit_type_%(c_name)s_members(v, *obj, &err); error_propagate(errp, err); err = NULL; out_obj: