mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-23 00:35:34 +00:00
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
This commit is contained in:
parent
825fb4835b
commit
d28c6244c0
|
@ -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:
|
||||
|
|
|
@ -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('''
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue