aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-09-12 16:53:03 +0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-10-02 19:09:13 +0200
commit422ca1432f7b44f2a9f3ad94a65d36927da021fa (patch)
treef3e40515a787ebf8ad6117f1b08df14324f190e4 /qom/object.c
parentdcf6760a64f6cacc5b7a77b0e530f3fffef5e189 (diff)
qom/object: add some interface asserts
An interface can't have any instance size or callback, or itself implement other interfaces (this is unsupported). Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20180912125303.29158-1-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/qom/object.c b/qom/object.c
index 75d1d48944..9222b23172 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -286,7 +286,14 @@ static void type_initialize(TypeImpl *ti)
if (ti->instance_size == 0) {
ti->abstract = true;
}
-
+ if (type_is_ancestor(ti, 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(ti);