On Tue, Feb 20, 2024 at 04:06:16PM +0000, Peter Maydell wrote: > Date: Tue, 20 Feb 2024 16:06:16 +0000 > From: Peter Maydell <peter.mayd...@linaro.org> > Subject: [PATCH 04/10] include/qom/object.h: New > OBJECT_DEFINE_SIMPLE_TYPE{, _WITH_INTERFACES} macros > X-Mailer: git-send-email 2.34.1 > > We have an OBJECT_DEFINE_TYPE_EXTENDED macro, plus several variations > on it, which emits the boilerplate for the TypeInfo and ensures it is > registered with the type system. However, all the existing macros > insist that the type being defined has its own FooClass struct, so > they aren't useful for the common case of a simple leaf class which > doesn't have any new methods or any other need for its own class > struct (that is, for the kind of type that OBJECT_DECLARE_SIMPLE_TYPE > declares). > > Pull the actual implementation of OBJECT_DEFINE_TYPE_EXTENDED out > into a new DO_OBJECT_DEFINE_TYPE_EXTENDED which parameterizes the > value we use for the class_size field. This lets us add a new > OBJECT_DEFINE_SIMPLE_TYPE which does the same job as the various > existing OBJECT_DEFINE_*_TYPE_* family macros for this kind of simple > type, and the variant OBJECT_DEFINE_SIMPLE_TYPE_WITH_INTERFACES for > when the type will implement some interfaces. > > Reviewed-by: Daniel P. Berrangé <berra...@redhat.com> > Signed-off-by: Peter Maydell <peter.mayd...@linaro.org> > --- > docs/devel/qom.rst | 34 +++++++++++-- > include/qom/object.h | 114 +++++++++++++++++++++++++++++++++---------- > 2 files changed, 117 insertions(+), 31 deletions(-) >
Reviewed-by: Zhao Liu <zhao1....@intel.com>