On 2/20/24 06:06, Peter Maydell wrote:
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: Richard Henderson <richard.hender...@linaro.org>
r~