Paolo Bonzini <pbonz...@redhat.com> writes: > On 03/07/19 07:05, Markus Armbruster wrote: >> static const TypeInfo iommu_memory_region_info = { >> .parent = TYPE_MEMORY_REGION, >> .name = TYPE_IOMMU_MEMORY_REGION, >> .class_size = sizeof(IOMMUMemoryRegionClass), >> .instance_size = sizeof(IOMMUMemoryRegion), >> .instance_init = iommu_memory_region_initfn, >> .abstract = true, >> }; >> >> typedef struct IOMMUMemoryRegionClass { >> /* private */ >> ---> struct DeviceClass parent_class; >> [...] >> }; >> >> struct IOMMUMemoryRegion { >> MemoryRegion parent_obj; >> [...] >> }; >> >> The parent is TYPE_MEMORY_REGION, and the instance struct's first member is >> TYPE_MEMORY_REGION's instance struct as I expect, but the class struct's >> first member is something else entirely. > > Cut-and-paste error. MemoryRegion adds no methods so that could be
I wonder whether there's anything we could do to catch such errors automatically. > either ObjectClass or better > > typedef struct MemoryRegionClass { > /* private */ > ObjectClass parent_class; > } ObjectClass; I'll prepare the patch. Thanks!