Commit 70d3ce61f4 for qemu.org

commit 70d3ce61f41ad6964386ef17861466e46fede518
Author: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Date:   Tue Aug 25 14:41:22 2026 +0100

    qom/object.c: introduce OBJECT_CLASS_PROPERTY_SCALAR_GETTER(type) macro

    This macro will be used to generate the boilerplate property_class_get_type_ptr()
    QOM get function for the specified scalar type.

    Note that since the macro is currently unused, the object_class_prop_ptr() helper
    function is temporarily marked as __attribute__((unused)) to allow compilation to
    succeed.

    Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
    Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
    Message-Id: <20260825134320.1039012-2-mark.caveayland@nutanix.com>

diff --git a/qom/object.c b/qom/object.c
index 47977b1f44..e32ae30bd5 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2703,6 +2703,28 @@ DEFINE_OBJECT_PROPERTY_SCALAR_METHODS(uint64)
 #undef DEFINE_OBJECT_PROPERTY_SCALAR_METHODS


+__attribute__((unused))
+static void *object_class_prop_ptr(Object *obj, ptrdiff_t offset)
+{
+    void *ptr = obj;
+    ptr += offset;
+
+    return ptr;
+}
+
+#define OBJECT_CLASS_PROPERTY_SCALAR_GETTER(type) \
+    static void property_class_get_##type##_ptr(Object *obj, Visitor *v, \
+                                                const char *name, \
+                                                void *opaque, Error **errp) \
+    { \
+        type##_t value = *(type##_t *)object_class_prop_ptr(obj, \
+                                                        (ptrdiff_t)opaque); \
+        visit_type_##type(v, name, &value, errp); \
+    }
+
+#undef OBJECT_CLASS_PROPERTY_SCALAR_GETTER
+
+
 ObjectProperty *
 object_property_add_uint8_ptr(Object *obj, const char *name,
                               const uint8_t *v,