mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2024-12-31 23:15:44 +00:00
qom/object: add some interface asserts
An interface can't have any instance size or callback, or itself implement other interfaces (this is unsupported). Backports commit 422ca1432f7b44f2a9f3ad94a65d36927da021fa from qemu
This commit is contained in:
parent
752aea8379
commit
710467e034
|
@ -273,7 +273,18 @@ static void type_initialize(struct uc_struct *uc, TypeImpl *ti)
|
|||
|
||||
ti->class_size = type_class_get_size(uc, ti);
|
||||
ti->instance_size = type_object_get_size(uc, ti);
|
||||
if (ti->instance_size == 0) {
|
||||
ti->abstract = true;
|
||||
}
|
||||
|
||||
if (type_is_ancestor(uc, ti, uc->type_interface)) {
|
||||
assert(ti->instance_size == 0);
|
||||
assert(ti->abstract);
|
||||
assert(!ti->instance_init);
|
||||
assert(!ti->instance_post_init);
|
||||
assert(!ti->instance_finalize);
|
||||
assert(!ti->num_interfaces);
|
||||
}
|
||||
ti->class = g_malloc0(ti->class_size);
|
||||
|
||||
parent = type_get_parent(uc, ti);
|
||||
|
|
Loading…
Reference in a new issue