diff options
author | Eduardo Habkost <ehabkost@redhat.com> | 2015-08-20 14:54:35 -0700 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2015-09-19 16:39:19 +0200 |
commit | dcb3d601115eed77aef543fe3a920adc17544e06 (patch) | |
tree | 75689324209c954b0a2cef64d477380bc741f529 /hw/core/machine.c | |
parent | c0f365186b30f97ef221489834e7ae146fc22db8 (diff) |
machine: Ensure all TYPE_MACHINE subclasses have the right suffix
Now that all non-abstract TYPE_MACHINE subclasses have the -machine
suffix, add an assert to ensure this will be always true.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'hw/core/machine.c')
-rw-r--r-- | hw/core/machine.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hw/core/machine.c b/hw/core/machine.c index 51ed6b2e05..3c1f248e80 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -316,6 +316,14 @@ static void machine_class_init(ObjectClass *oc, void *data) mc->default_ram_size = 128 * M_BYTE; } +static void machine_class_base_init(ObjectClass *oc, void *data) +{ + if (!object_class_is_abstract(oc)) { + const char *cname = object_class_get_name(oc); + assert(g_str_has_suffix(cname, TYPE_MACHINE_SUFFIX)); + } +} + static void machine_initfn(Object *obj) { MachineState *ms = MACHINE(obj); @@ -492,6 +500,7 @@ static const TypeInfo machine_info = { .abstract = true, .class_size = sizeof(MachineClass), .class_init = machine_class_init, + .class_base_init = machine_class_base_init, .instance_size = sizeof(MachineState), .instance_init = machine_initfn, .instance_finalize = machine_finalize, |