qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] qom: Rename Object::class into Object::klass
@ 2024-06-24 20:43 Felix Wu
  2024-06-24 20:44 ` [PATCH 2/2] include/qom: Rename typename into type_name Felix Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Felix Wu @ 2024-06-24 20:43 UTC (permalink / raw)
  To: peter.maydell
  Cc: pbonzini, berrange, eduardo, peterx, david, philmd, qemu-devel,
	Roman Kiryanov, Felix Wu

From: Roman Kiryanov <rkir@google.com>

'class' is a C++ keyword and it prevents from
using the QEMU headers with a C++ compiler.

Google-Bug-Id: 331190993
Change-Id: I9ab7d2d77edef654a9c7b7cb9cd01795a6ed65a2
Signed-off-by: Felix Wu <flwu@google.com>
Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 hw/core/qdev-properties-system.c |  2 +-
 include/exec/memory.h            |  2 +-
 include/qom/object.h             |  2 +-
 qom/object.c                     | 90 ++++++++++++++++----------------
 4 files changed, 48 insertions(+), 48 deletions(-)

diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index f13350b4fb..a6781841af 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -431,7 +431,7 @@ static void set_netdev(Object *obj, Visitor *v, const char *name,
         }
 
         if (peers[i]->info->check_peer_type) {
-            if (!peers[i]->info->check_peer_type(peers[i], obj->class, errp)) {
+            if (!peers[i]->info->check_peer_type(peers[i], obj->klass, errp)) {
                 goto out;
             }
         }
diff --git a/include/exec/memory.h b/include/exec/memory.h
index 2d7c278b9f..e5bd75956e 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -1808,7 +1808,7 @@ static inline IOMMUMemoryRegion *memory_region_get_iommu(MemoryRegion *mr)
 static inline IOMMUMemoryRegionClass *memory_region_get_iommu_class_nocheck(
         IOMMUMemoryRegion *iommu_mr)
 {
-    return (IOMMUMemoryRegionClass *) (((Object *)iommu_mr)->class);
+    return (IOMMUMemoryRegionClass *) (((Object *)iommu_mr)->klass);
 }
 
 #define memory_region_is_iommu(mr) (memory_region_get_iommu(mr) != NULL)
diff --git a/include/qom/object.h b/include/qom/object.h
index 13d3a655dd..7afdb261a8 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -153,7 +153,7 @@ struct ObjectClass
 struct Object
 {
     /* private: */
-    ObjectClass *class;
+    ObjectClass *klass;
     ObjectFree *free;
     GHashTable *properties;
     uint32_t ref;
diff --git a/qom/object.c b/qom/object.c
index 157a45c5f8..133cd08763 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -68,7 +68,7 @@ struct TypeImpl
     const char *parent;
     TypeImpl *parent_type;
 
-    ObjectClass *class;
+    ObjectClass *klass;
 
     int num_interfaces;
     InterfaceImpl interfaces[MAX_INTERFACES];
@@ -304,11 +304,11 @@ static void type_initialize_interface(TypeImpl *ti, TypeImpl *interface_type,
     type_initialize(iface_impl);
     g_free((char *)info.name);
 
-    new_iface = (InterfaceClass *)iface_impl->class;
-    new_iface->concrete_class = ti->class;
+    new_iface = (InterfaceClass *)iface_impl->klass;
+    new_iface->concrete_class = ti->klass;
     new_iface->interface_type = interface_type;
 
-    ti->class->interfaces = g_slist_append(ti->class->interfaces, new_iface);
+    ti->klass->interfaces = g_slist_append(ti->klass->interfaces, new_iface);
 }
 
 static void object_property_free(gpointer data)
@@ -329,7 +329,7 @@ static void type_initialize(TypeImpl *ti)
 {
     TypeImpl *parent;
 
-    if (ti->class) {
+    if (ti->klass) {
         return;
     }
 
@@ -350,7 +350,7 @@ static void type_initialize(TypeImpl *ti)
         assert(!ti->instance_finalize);
         assert(!ti->num_interfaces);
     }
-    ti->class = g_malloc0(ti->class_size);
+    ti->klass = g_malloc0(ti->class_size);
 
     parent = type_get_parent(ti);
     if (parent) {
@@ -360,10 +360,10 @@ static void type_initialize(TypeImpl *ti)
 
         g_assert(parent->class_size <= ti->class_size);
         g_assert(parent->instance_size <= ti->instance_size);
-        memcpy(ti->class, parent->class, parent->class_size);
-        ti->class->interfaces = NULL;
+        memcpy(ti->klass, parent->klass, parent->class_size);
+        ti->klass->interfaces = NULL;
 
-        for (e = parent->class->interfaces; e; e = e->next) {
+        for (e = parent->klass->interfaces; e; e = e->next) {
             InterfaceClass *iface = e->data;
             ObjectClass *klass = OBJECT_CLASS(iface);
 
@@ -377,7 +377,7 @@ static void type_initialize(TypeImpl *ti)
                              ti->interfaces[i].typename, parent->name);
                 abort();
             }
-            for (e = ti->class->interfaces; e; e = e->next) {
+            for (e = ti->klass->interfaces; e; e = e->next) {
                 TypeImpl *target_type = OBJECT_CLASS(e->data)->type;
 
                 if (type_is_ancestor(target_type, t)) {
@@ -393,20 +393,20 @@ static void type_initialize(TypeImpl *ti)
         }
     }
 
-    ti->class->properties = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
+    ti->klass->properties = g_hash_table_new_full(g_str_hash, g_str_equal, NULL,
                                                   object_property_free);
 
-    ti->class->type = ti;
+    ti->klass->type = ti;
 
     while (parent) {
         if (parent->class_base_init) {
-            parent->class_base_init(ti->class, ti->class_data);
+            parent->class_base_init(ti->klass, ti->class_data);
         }
         parent = type_get_parent(parent);
     }
 
     if (ti->class_init) {
-        ti->class_init(ti->class, ti->class_data);
+        ti->class_init(ti->klass, ti->class_data);
     }
 }
 
@@ -554,7 +554,7 @@ static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type
     g_assert(size >= type->instance_size);
 
     memset(obj, 0, type->instance_size);
-    obj->class = type->class;
+    obj->klass = type->klass;
     object_ref(obj);
     object_class_property_init_all(obj);
     obj->properties = g_hash_table_new_full(g_str_hash, g_str_equal,
@@ -731,7 +731,7 @@ static void object_deinit(Object *obj, TypeImpl *type)
 static void object_finalize(void *data)
 {
     Object *obj = data;
-    TypeImpl *ti = obj->class->type;
+    TypeImpl *ti = obj->klass->type;
 
     object_property_del_all(obj);
     object_deinit(obj, ti);
@@ -912,7 +912,7 @@ Object *object_dynamic_cast(Object *obj, const char *typename)
 Object *object_dynamic_cast_assert(Object *obj, const char *typename,
                                    const char *file, int line, const char *func)
 {
-    trace_object_dynamic_cast_assert(obj ? obj->class->type->name : "(null)",
+    trace_object_dynamic_cast_assert(obj ? obj->klass->type->name : "(null)",
                                      typename, file, line, func);
 
 #ifdef CONFIG_QOM_CAST_DEBUG
@@ -920,7 +920,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
     Object *inst;
 
     for (i = 0; obj && i < OBJECT_CLASS_CAST_CACHE; i++) {
-        if (qatomic_read(&obj->class->object_cast_cache[i]) == typename) {
+        if (qatomic_read(&obj->klass->object_cast_cache[i]) == typename) {
             goto out;
         }
     }
@@ -937,10 +937,10 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
 
     if (obj && obj == inst) {
         for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
-            qatomic_set(&obj->class->object_cast_cache[i - 1],
-                       qatomic_read(&obj->class->object_cast_cache[i]));
+            qatomic_set(&obj->klass->object_cast_cache[i - 1],
+                       qatomic_read(&obj->klass->object_cast_cache[i]));
         }
-        qatomic_set(&obj->class->object_cast_cache[i - 1], typename);
+        qatomic_set(&obj->klass->object_cast_cache[i - 1], typename);
     }
 
 out:
@@ -971,7 +971,7 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
         return NULL;
     }
 
-    if (type->class->interfaces &&
+    if (type->klass->interfaces &&
             type_is_ancestor(target_type, type_interface)) {
         int found = 0;
         GSList *i;
@@ -996,45 +996,45 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
     return ret;
 }
 
-ObjectClass *object_class_dynamic_cast_assert(ObjectClass *class,
+ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
                                               const char *typename,
                                               const char *file, int line,
                                               const char *func)
 {
     ObjectClass *ret;
 
-    trace_object_class_dynamic_cast_assert(class ? class->type->name : "(null)",
+    trace_object_class_dynamic_cast_assert(klass ? klass->type->name : "(null)",
                                            typename, file, line, func);
 
 #ifdef CONFIG_QOM_CAST_DEBUG
     int i;
 
-    for (i = 0; class && i < OBJECT_CLASS_CAST_CACHE; i++) {
-        if (qatomic_read(&class->class_cast_cache[i]) == typename) {
-            ret = class;
+    for (i = 0; klass && i < OBJECT_CLASS_CAST_CACHE; i++) {
+        if (qatomic_read(&klass->class_cast_cache[i]) == typename) {
+            ret = klass;
             goto out;
         }
     }
 #else
-    if (!class || !class->interfaces) {
-        return class;
+    if (!klass || !klass->interfaces) {
+        return klass;
     }
 #endif
 
-    ret = object_class_dynamic_cast(class, typename);
-    if (!ret && class) {
+    ret = object_class_dynamic_cast(klass, typename);
+    if (!ret && klass) {
         fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
-                file, line, func, class, typename);
+                file, line, func, klass, typename);
         abort();
     }
 
 #ifdef CONFIG_QOM_CAST_DEBUG
-    if (class && ret == class) {
+    if (klass && ret == klass) {
         for (i = 1; i < OBJECT_CLASS_CAST_CACHE; i++) {
-            qatomic_set(&class->class_cast_cache[i - 1],
-                       qatomic_read(&class->class_cast_cache[i]));
+            qatomic_set(&klass->class_cast_cache[i - 1],
+                       qatomic_read(&klass->class_cast_cache[i]));
         }
-        qatomic_set(&class->class_cast_cache[i - 1], typename);
+        qatomic_set(&klass->class_cast_cache[i - 1], typename);
     }
 out:
 #endif
@@ -1043,12 +1043,12 @@ out:
 
 const char *object_get_typename(const Object *obj)
 {
-    return obj->class->type->name;
+    return obj->klass->type->name;
 }
 
 ObjectClass *object_get_class(Object *obj)
 {
-    return obj->class;
+    return obj->klass;
 }
 
 bool object_class_is_abstract(ObjectClass *klass)
@@ -1071,7 +1071,7 @@ ObjectClass *object_class_by_name(const char *typename)
 
     type_initialize(type);
 
-    return type->class;
+    return type->klass;
 }
 
 ObjectClass *module_object_class_by_name(const char *typename)
@@ -1093,9 +1093,9 @@ ObjectClass *module_object_class_by_name(const char *typename)
     return oc;
 }
 
-ObjectClass *object_class_get_parent(ObjectClass *class)
+ObjectClass *object_class_get_parent(ObjectClass *klass)
 {
-    TypeImpl *type = type_get_parent(class->type);
+    TypeImpl *type = type_get_parent(klass->type);
 
     if (!type) {
         return NULL;
@@ -1103,7 +1103,7 @@ ObjectClass *object_class_get_parent(ObjectClass *class)
 
     type_initialize(type);
 
-    return type->class;
+    return type->klass;
 }
 
 typedef struct OCFData
@@ -1122,7 +1122,7 @@ static void object_class_foreach_tramp(gpointer key, gpointer value,
     ObjectClass *k;
 
     type_initialize(type);
-    k = type->class;
+    k = type->klass;
 
     if (!data->include_abstract && type->abstract) {
         return;
@@ -1792,8 +1792,8 @@ static void object_finalize_child_property(Object *obj, const char *name,
 {
     Object *child = opaque;
 
-    if (child->class->unparent) {
-        (child->class->unparent)(child);
+    if (child->klass->unparent) {
+        (child->klass->unparent)(child);
     }
     child->parent = NULL;
     object_unref(child);
-- 
2.45.2.741.gdbec12cfda-goog



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] include/qom: Rename typename into type_name
  2024-06-24 20:43 [PATCH 1/2] qom: Rename Object::class into Object::klass Felix Wu
@ 2024-06-24 20:44 ` Felix Wu
  2024-06-25  2:20 ` [PATCH 1/2] qom: Rename Object::class into Object::klass Philippe Mathieu-Daudé
  2024-06-25  7:15 ` Daniel P. Berrangé
  2 siblings, 0 replies; 6+ messages in thread
From: Felix Wu @ 2024-06-24 20:44 UTC (permalink / raw)
  To: peter.maydell
  Cc: pbonzini, berrange, eduardo, peterx, david, philmd, qemu-devel,
	Roman Kiryanov, Felix Wu

From: Roman Kiryanov <rkir@google.com>

`typename` is a C++ keyword and it prevents from
using the QEMU headers with a C++ compiler.

Google-Bug-Id: 331190993
Change-Id: Iff313ca5ec157a1a3826b4f5665073534d961a26
Signed-off-by: Felix Wu <flwu@google.com>
Signed-off-by: Roman Kiryanov <rkir@google.com>
---
 hw/core/bus.c          |   8 +--
 include/hw/qdev-core.h |   4 +-
 include/qom/object.h   |  78 +++++++++++++--------------
 qom/object.c           | 120 ++++++++++++++++++++---------------------
 4 files changed, 105 insertions(+), 105 deletions(-)

diff --git a/hw/core/bus.c b/hw/core/bus.c
index b9d89495cd..07c5a83673 100644
--- a/hw/core/bus.c
+++ b/hw/core/bus.c
@@ -152,18 +152,18 @@ static void bus_unparent(Object *obj)
     bus->parent = NULL;
 }
 
-void qbus_init(void *bus, size_t size, const char *typename,
+void qbus_init(void *bus, size_t size, const char *type_name,
                DeviceState *parent, const char *name)
 {
-    object_initialize(bus, size, typename);
+    object_initialize(bus, size, type_name);
     qbus_init_internal(bus, parent, name);
 }
 
-BusState *qbus_new(const char *typename, DeviceState *parent, const char *name)
+BusState *qbus_new(const char *type_name, DeviceState *parent, const char *name)
 {
     BusState *bus;
 
-    bus = BUS(object_new(typename));
+    bus = BUS(object_new(type_name));
     qbus_init_internal(bus, parent, name);
 
     return bus;
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 5336728a23..ede4b74bd8 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -867,9 +867,9 @@ DeviceState *qdev_find_recursive(BusState *bus, const char *id);
 typedef int (qbus_walkerfn)(BusState *bus, void *opaque);
 typedef int (qdev_walkerfn)(DeviceState *dev, void *opaque);
 
-void qbus_init(void *bus, size_t size, const char *typename,
+void qbus_init(void *bus, size_t size, const char *type_name,
                DeviceState *parent, const char *name);
-BusState *qbus_new(const char *typename, DeviceState *parent, const char *name);
+BusState *qbus_new(const char *type_name, DeviceState *parent, const char *name);
 bool qbus_realize(BusState *bus, Error **errp);
 void qbus_unrealize(BusState *bus);
 
diff --git a/include/qom/object.h b/include/qom/object.h
index 7afdb261a8..4e69a3506d 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -617,7 +617,7 @@ Object *object_new_with_class(ObjectClass *klass);
 
 /**
  * object_new:
- * @typename: The name of the type of the object to instantiate.
+ * @type_name: The name of the type of the object to instantiate.
  *
  * This function will initialize a new object using heap allocated memory.
  * The returned object has a reference count of 1, and will be freed when
@@ -625,11 +625,11 @@ Object *object_new_with_class(ObjectClass *klass);
  *
  * Returns: The newly allocated and instantiated object.
  */
-Object *object_new(const char *typename);
+Object *object_new(const char *type_name);
 
 /**
  * object_new_with_props:
- * @typename:  The name of the type of the object to instantiate.
+ * @type_name:  The name of the type of the object to instantiate.
  * @parent: the parent object
  * @id: The unique ID of the object
  * @errp: pointer to error object
@@ -673,7 +673,7 @@ Object *object_new(const char *typename);
  *
  * Returns: The newly allocated, instantiated & initialized object.
  */
-Object *object_new_with_props(const char *typename,
+Object *object_new_with_props(const char *type_name,
                               Object *parent,
                               const char *id,
                               Error **errp,
@@ -681,7 +681,7 @@ Object *object_new_with_props(const char *typename,
 
 /**
  * object_new_with_propv:
- * @typename:  The name of the type of the object to instantiate.
+ * @type_name:  The name of the type of the object to instantiate.
  * @parent: the parent object
  * @id: The unique ID of the object
  * @errp: pointer to error object
@@ -689,7 +689,7 @@ Object *object_new_with_props(const char *typename,
  *
  * See object_new_with_props() for documentation.
  */
-Object *object_new_with_propv(const char *typename,
+Object *object_new_with_propv(const char *type_name,
                               Object *parent,
                               const char *id,
                               Error **errp,
@@ -755,13 +755,13 @@ bool object_set_propv(Object *obj, Error **errp, va_list vargs);
  * object_initialize:
  * @obj: A pointer to the memory to be used for the object.
  * @size: The maximum size available at @obj for the object.
- * @typename: The name of the type of the object to instantiate.
+ * @type_name: The name of the type of the object to instantiate.
  *
  * This function will initialize an object.  The memory for the object should
  * have already been allocated.  The returned object has a reference count of 1,
  * and will be finalized when the last reference is dropped.
  */
-void object_initialize(void *obj, size_t size, const char *typename);
+void object_initialize(void *obj, size_t size, const char *type_name);
 
 /**
  * object_initialize_child_with_props:
@@ -834,19 +834,19 @@ void object_initialize_child_internal(Object *parent, const char *propname,
 /**
  * object_dynamic_cast:
  * @obj: The object to cast.
- * @typename: The @typename to cast to.
+ * @type_name: The @type_name to cast to.
  *
- * This function will determine if @obj is-a @typename.  @obj can refer to an
+ * This function will determine if @obj is-a @type_name.  @obj can refer to an
  * object or an interface associated with an object.
  *
  * Returns: This function returns @obj on success or #NULL on failure.
  */
-Object *object_dynamic_cast(Object *obj, const char *typename);
+Object *object_dynamic_cast(Object *obj, const char *type_name);
 
 /**
  * object_dynamic_cast_assert:
  * @obj: The object to cast.
- * @typename: The @typename to cast to.
+ * @type_name: The @type_name to cast to.
  * @file: Source code file where function was called
  * @line: Source code line where function was called
  * @func: Name of function where this function was called
@@ -857,7 +857,7 @@ Object *object_dynamic_cast(Object *obj, const char *typename);
  * This function is not meant to be called directly, but only through
  * the wrapper macro OBJECT_CHECK.
  */
-Object *object_dynamic_cast_assert(Object *obj, const char *typename,
+Object *object_dynamic_cast_assert(Object *obj, const char *type_name,
                                    const char *file, int line, const char *func);
 
 /**
@@ -948,7 +948,7 @@ void object_set_properties_from_keyval(Object *obj, const QDict *qdict,
 /**
  * object_class_dynamic_cast_assert:
  * @klass: The #ObjectClass to attempt to cast.
- * @typename: The QOM typename of the class to cast to.
+ * @type_name: The QOM typename of the class to cast to.
  * @file: Source code file where function was called
  * @line: Source code line where function was called
  * @func: Name of function where this function was called
@@ -960,26 +960,26 @@ void object_set_properties_from_keyval(Object *obj, const QDict *qdict,
  * the wrapper macro OBJECT_CLASS_CHECK.
  */
 ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
-                                              const char *typename,
+                                              const char *type_name,
                                               const char *file, int line,
                                               const char *func);
 
 /**
  * object_class_dynamic_cast:
  * @klass: The #ObjectClass to attempt to cast.
- * @typename: The QOM typename of the class to cast to.
+ * @type_name: The QOM typename of the class to cast to.
  *
- * Returns: If @typename is a class, this function returns @klass if
- * @typename is a subtype of @klass, else returns #NULL.
+ * Returns: If @type_name is a class, this function returns @klass if
+ * @type_name is a subtype of @klass, else returns #NULL.
  *
- * If @typename is an interface, this function returns the interface
+ * If @type_name is an interface, this function returns the interface
  * definition for @klass if @klass implements it unambiguously; #NULL
  * is returned if @klass does not implement the interface or if multiple
  * classes or interfaces on the hierarchy leading to @klass implement
  * it.  (FIXME: perhaps this can be detected at type definition time?)
  */
 ObjectClass *object_class_dynamic_cast(ObjectClass *klass,
-                                       const char *typename);
+                                       const char *type_name);
 
 /**
  * object_class_get_parent:
@@ -1007,23 +1007,23 @@ bool object_class_is_abstract(ObjectClass *klass);
 
 /**
  * object_class_by_name:
- * @typename: The QOM typename to obtain the class for.
+ * @type_name: The QOM typename to obtain the class for.
  *
- * Returns: The class for @typename or %NULL if not found.
+ * Returns: The class for @type_name or %NULL if not found.
  */
-ObjectClass *object_class_by_name(const char *typename);
+ObjectClass *object_class_by_name(const char *type_name);
 
 /**
  * module_object_class_by_name:
- * @typename: The QOM typename to obtain the class for.
+ * @type_name: The QOM typename to obtain the class for.
  *
  * For objects which might be provided by a module.  Behaves like
  * object_class_by_name, but additionally tries to load the module
  * needed in case the class is not available.
  *
- * Returns: The class for @typename or %NULL if not found.
+ * Returns: The class for @type_name or %NULL if not found.
  */
-ObjectClass *module_object_class_by_name(const char *typename);
+ObjectClass *module_object_class_by_name(const char *type_name);
 
 void object_class_foreach(void (*fn)(ObjectClass *klass, void *opaque),
                           const char *implements_type, bool include_abstract,
@@ -1452,7 +1452,7 @@ uint64_t object_property_get_uint(Object *obj, const char *name,
  * object_property_get_enum:
  * @obj: the object
  * @name: the name of the property
- * @typename: the name of the enum data type
+ * @type_name: the name of the enum data type
  * @errp: returns an error if this function fails
  *
  * Returns: the value of the property, converted to an integer (which
@@ -1460,7 +1460,7 @@ uint64_t object_property_get_uint(Object *obj, const char *name,
  * value is not an enum).
  */
 int object_property_get_enum(Object *obj, const char *name,
-                             const char *typename, Error **errp);
+                             const char *type_name, Error **errp);
 
 /**
  * object_property_set:
@@ -1594,7 +1594,7 @@ Object *object_resolve_path(const char *path, bool *ambiguous);
 /**
  * object_resolve_path_type:
  * @path: the path to resolve
- * @typename: the type to look for.
+ * @type_name: the type to look for.
  * @ambiguous: returns true if the path resolution failed because of an
  *   ambiguous match
  *
@@ -1604,12 +1604,12 @@ Object *object_resolve_path(const char *path, bool *ambiguous);
  * ambiguous.
  *
  * For both partial and absolute paths, the return value goes through
- * a dynamic cast to @typename.  This is important if either the link,
- * or the typename itself are of interface types.
+ * a dynamic cast to @type_name.  This is important if either the link,
+ * or the @type_name itself are of interface types.
  *
  * Returns: The matched object or NULL on path lookup failure.
  */
-Object *object_resolve_path_type(const char *path, const char *typename,
+Object *object_resolve_path_type(const char *path, const char *type_name,
                                  bool *ambiguous);
 
 /**
@@ -1797,25 +1797,25 @@ ObjectProperty *object_class_property_add_bool(ObjectClass *klass,
  * object_property_add_enum:
  * @obj: the object to add a property to
  * @name: the name of the property
- * @typename: the name of the enum data type
+ * @type_name: the name of the enum data type
  * @lookup: enum value namelookup table
  * @get: the getter or %NULL if the property is write-only.
  * @set: the setter or %NULL if the property is read-only
  *
  * Add an enum property using getters/setters.  This function will add a
- * property of type '@typename'.
+ * property of type '@type_name'.
  *
  * Returns: The newly added property on success, or %NULL on failure.
  */
 ObjectProperty *object_property_add_enum(Object *obj, const char *name,
-                              const char *typename,
+                              const char *type_name,
                               const QEnumLookup *lookup,
                               int (*get)(Object *, Error **),
                               void (*set)(Object *, int, Error **));
 
 ObjectProperty *object_class_property_add_enum(ObjectClass *klass,
                                     const char *name,
-                                    const char *typename,
+                                    const char *type_name,
                                     const QEnumLookup *lookup,
                                     int (*get)(Object *, Error **),
                                     void (*set)(Object *, int, Error **));
@@ -2034,11 +2034,11 @@ Object *container_get(Object *root, const char *path);
 
 /**
  * object_type_get_instance_size:
- * @typename: Name of the Type whose instance_size is required
+ * @type_name: Name of the Type whose instance_size is required
  *
- * Returns the instance_size of the given @typename.
+ * Returns the instance_size of the given @type_name.
  */
-size_t object_type_get_instance_size(const char *typename);
+size_t object_type_get_instance_size(const char *type_name);
 
 /**
  * object_property_help:
diff --git a/qom/object.c b/qom/object.c
index 133cd08763..17f5bf11f4 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -42,7 +42,7 @@ typedef struct TypeImpl TypeImpl;
 
 struct InterfaceImpl
 {
-    const char *typename;
+    const char *type_name;
 };
 
 struct TypeImpl
@@ -130,7 +130,7 @@ static TypeImpl *type_new(const TypeInfo *info)
     ti->abstract = info->abstract;
 
     for (i = 0; info->interfaces && info->interfaces[i].type; i++) {
-        ti->interfaces[i].typename = g_strdup(info->interfaces[i].type);
+        ti->interfaces[i].type_name = g_strdup(info->interfaces[i].type);
     }
     ti->num_interfaces = i;
 
@@ -262,9 +262,9 @@ static size_t type_object_get_align(TypeImpl *ti)
     return 0;
 }
 
-size_t object_type_get_instance_size(const char *typename)
+size_t object_type_get_instance_size(const char *type_name)
 {
-    TypeImpl *type = type_get_by_name(typename);
+    TypeImpl *type = type_get_by_name(type_name);
 
     g_assert(type != NULL);
     return type_object_get_size(type);
@@ -371,10 +371,10 @@ static void type_initialize(TypeImpl *ti)
         }
 
         for (i = 0; i < ti->num_interfaces; i++) {
-            TypeImpl *t = type_get_by_name(ti->interfaces[i].typename);
+            TypeImpl *t = type_get_by_name(ti->interfaces[i].type_name);
             if (!t) {
                 error_report("missing interface '%s' for object '%s'",
-                             ti->interfaces[i].typename, parent->name);
+                             ti->interfaces[i].type_name, parent->name);
                 abort();
             }
             for (e = ti->klass->interfaces; e; e = e->next) {
@@ -563,23 +563,23 @@ static void object_initialize_with_type(Object *obj, size_t size, TypeImpl *type
     object_post_init_with_type(obj, type);
 }
 
-void object_initialize(void *data, size_t size, const char *typename)
+void object_initialize(void *data, size_t size, const char *type_name)
 {
-    TypeImpl *type = type_get_by_name(typename);
+    TypeImpl *type = type_get_by_name(type_name);
 
 #ifdef CONFIG_MODULES
     if (!type) {
-        int rv = module_load_qom(typename, &error_fatal);
+        int rv = module_load_qom(type_name, &error_fatal);
         if (rv > 0) {
-            type = type_get_by_name(typename);
+            type = type_get_by_name(type_name);
         } else {
-            error_report("missing object type '%s'", typename);
+            error_report("missing object type '%s'", type_name);
             exit(1);
         }
     }
 #endif
     if (!type) {
-        error_report("missing object type '%s'", typename);
+        error_report("missing object type '%s'", type_name);
         abort();
     }
 
@@ -790,15 +790,15 @@ Object *object_new_with_class(ObjectClass *klass)
     return object_new_with_type(klass->type);
 }
 
-Object *object_new(const char *typename)
+Object *object_new(const char *type_name)
 {
-    TypeImpl *ti = type_get_by_name(typename);
+    TypeImpl *ti = type_get_by_name(type_name);
 
     return object_new_with_type(ti);
 }
 
 
-Object *object_new_with_props(const char *typename,
+Object *object_new_with_props(const char *type_name,
                               Object *parent,
                               const char *id,
                               Error **errp,
@@ -808,14 +808,14 @@ Object *object_new_with_props(const char *typename,
     Object *obj;
 
     va_start(vargs, errp);
-    obj = object_new_with_propv(typename, parent, id, errp, vargs);
+    obj = object_new_with_propv(type_name, parent, id, errp, vargs);
     va_end(vargs);
 
     return obj;
 }
 
 
-Object *object_new_with_propv(const char *typename,
+Object *object_new_with_propv(const char *type_name,
                               Object *parent,
                               const char *id,
                               Error **errp,
@@ -825,14 +825,14 @@ Object *object_new_with_propv(const char *typename,
     ObjectClass *klass;
     UserCreatable *uc;
 
-    klass = object_class_by_name(typename);
+    klass = object_class_by_name(type_name);
     if (!klass) {
-        error_setg(errp, "invalid object type: %s", typename);
+        error_setg(errp, "invalid object type: %s", type_name);
         return NULL;
     }
 
     if (object_class_is_abstract(klass)) {
-        error_setg(errp, "object type '%s' is abstract", typename);
+        error_setg(errp, "object type '%s' is abstract", type_name);
         return NULL;
     }
     obj = object_new_with_type(klass->type);
@@ -900,36 +900,36 @@ bool object_set_propv(Object *obj,
 }
 
 
-Object *object_dynamic_cast(Object *obj, const char *typename)
+Object *object_dynamic_cast(Object *obj, const char *type_name)
 {
-    if (obj && object_class_dynamic_cast(object_get_class(obj), typename)) {
+    if (obj && object_class_dynamic_cast(object_get_class(obj), type_name)) {
         return obj;
     }
 
     return NULL;
 }
 
-Object *object_dynamic_cast_assert(Object *obj, const char *typename,
+Object *object_dynamic_cast_assert(Object *obj, const char *type_name,
                                    const char *file, int line, const char *func)
 {
     trace_object_dynamic_cast_assert(obj ? obj->klass->type->name : "(null)",
-                                     typename, file, line, func);
+                                     type_name, file, line, func);
 
 #ifdef CONFIG_QOM_CAST_DEBUG
     int i;
     Object *inst;
 
     for (i = 0; obj && i < OBJECT_CLASS_CAST_CACHE; i++) {
-        if (qatomic_read(&obj->klass->object_cast_cache[i]) == typename) {
+        if (qatomic_read(&obj->klass->object_cast_cache[i]) == type_name) {
             goto out;
         }
     }
 
-    inst = object_dynamic_cast(obj, typename);
+    inst = object_dynamic_cast(obj, type_name);
 
     if (!inst && obj) {
         fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
-                file, line, func, obj, typename);
+                file, line, func, obj, type_name);
         abort();
     }
 
@@ -940,7 +940,7 @@ Object *object_dynamic_cast_assert(Object *obj, const char *typename,
             qatomic_set(&obj->klass->object_cast_cache[i - 1],
                        qatomic_read(&obj->klass->object_cast_cache[i]));
         }
-        qatomic_set(&obj->klass->object_cast_cache[i - 1], typename);
+        qatomic_set(&obj->klass->object_cast_cache[i - 1], type_name);
     }
 
 out:
@@ -949,7 +949,7 @@ out:
 }
 
 ObjectClass *object_class_dynamic_cast(ObjectClass *class,
-                                       const char *typename)
+                                       const char *type_name)
 {
     ObjectClass *ret = NULL;
     TypeImpl *target_type;
@@ -961,11 +961,11 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
 
     /* A simple fast path that can trigger a lot for leaf classes.  */
     type = class->type;
-    if (type->name == typename) {
+    if (type->name == type_name) {
         return class;
     }
 
-    target_type = type_get_by_name(typename);
+    target_type = type_get_by_name(type_name);
     if (!target_type) {
         /* target class type unknown, so fail the cast */
         return NULL;
@@ -997,20 +997,20 @@ ObjectClass *object_class_dynamic_cast(ObjectClass *class,
 }
 
 ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
-                                              const char *typename,
+                                              const char *type_name,
                                               const char *file, int line,
                                               const char *func)
 {
     ObjectClass *ret;
 
     trace_object_class_dynamic_cast_assert(klass ? klass->type->name : "(null)",
-                                           typename, file, line, func);
+                                           type_name, file, line, func);
 
 #ifdef CONFIG_QOM_CAST_DEBUG
     int i;
 
     for (i = 0; klass && i < OBJECT_CLASS_CAST_CACHE; i++) {
-        if (qatomic_read(&klass->class_cast_cache[i]) == typename) {
+        if (qatomic_read(&klass->class_cast_cache[i]) == type_name) {
             ret = klass;
             goto out;
         }
@@ -1021,10 +1021,10 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
     }
 #endif
 
-    ret = object_class_dynamic_cast(klass, typename);
+    ret = object_class_dynamic_cast(klass, type_name);
     if (!ret && klass) {
         fprintf(stderr, "%s:%d:%s: Object %p is not an instance of type %s\n",
-                file, line, func, klass, typename);
+                file, line, func, klass, type_name);
         abort();
     }
 
@@ -1034,7 +1034,7 @@ ObjectClass *object_class_dynamic_cast_assert(ObjectClass *klass,
             qatomic_set(&klass->class_cast_cache[i - 1],
                        qatomic_read(&klass->class_cast_cache[i]));
         }
-        qatomic_set(&klass->class_cast_cache[i - 1], typename);
+        qatomic_set(&klass->class_cast_cache[i - 1], type_name);
     }
 out:
 #endif
@@ -1061,9 +1061,9 @@ const char *object_class_get_name(ObjectClass *klass)
     return klass->type->name;
 }
 
-ObjectClass *object_class_by_name(const char *typename)
+ObjectClass *object_class_by_name(const char *type_name)
 {
-    TypeImpl *type = type_get_by_name(typename);
+    TypeImpl *type = type_get_by_name(type_name);
 
     if (!type) {
         return NULL;
@@ -1074,17 +1074,17 @@ ObjectClass *object_class_by_name(const char *typename)
     return type->klass;
 }
 
-ObjectClass *module_object_class_by_name(const char *typename)
+ObjectClass *module_object_class_by_name(const char *type_name)
 {
     ObjectClass *oc;
 
-    oc = object_class_by_name(typename);
+    oc = object_class_by_name(type_name);
 #ifdef CONFIG_MODULES
     if (!oc) {
         Error *local_err = NULL;
-        int rv = module_load_qom(typename, &local_err);
+        int rv = module_load_qom(type_name, &local_err);
         if (rv > 0) {
-            oc = object_class_by_name(typename);
+            oc = object_class_by_name(type_name);
         } else if (rv < 0) {
             error_report_err(local_err);
         }
@@ -1673,7 +1673,7 @@ typedef struct EnumProperty {
 } EnumProperty;
 
 int object_property_get_enum(Object *obj, const char *name,
-                             const char *typename, Error **errp)
+                             const char *type_name, Error **errp)
 {
     char *str;
     int ret;
@@ -1684,10 +1684,10 @@ int object_property_get_enum(Object *obj, const char *name,
         return -1;
     }
 
-    if (!g_str_equal(prop->type, typename)) {
+    if (!g_str_equal(prop->type, type_name)) {
         error_setg(errp, "Property %s on %s is not '%s' enum type",
                    name, object_class_get_name(
-                       object_get_class(obj)), typename);
+                       object_get_class(obj)), type_name);
         return -1;
     }
 
@@ -2127,16 +2127,16 @@ Object *object_resolve_path_component(Object *parent, const char *part)
 
 static Object *object_resolve_abs_path(Object *parent,
                                           char **parts,
-                                          const char *typename)
+                                          const char *type_name)
 {
     Object *child;
 
     if (*parts == NULL) {
-        return object_dynamic_cast(parent, typename);
+        return object_dynamic_cast(parent, type_name);
     }
 
     if (strcmp(*parts, "") == 0) {
-        return object_resolve_abs_path(parent, parts + 1, typename);
+        return object_resolve_abs_path(parent, parts + 1, type_name);
     }
 
     child = object_resolve_path_component(parent, *parts);
@@ -2144,19 +2144,19 @@ static Object *object_resolve_abs_path(Object *parent,
         return NULL;
     }
 
-    return object_resolve_abs_path(child, parts + 1, typename);
+    return object_resolve_abs_path(child, parts + 1, type_name);
 }
 
 static Object *object_resolve_partial_path(Object *parent,
                                            char **parts,
-                                           const char *typename,
+                                           const char *type_name,
                                            bool *ambiguous)
 {
     Object *obj;
     GHashTableIter iter;
     ObjectProperty *prop;
 
-    obj = object_resolve_abs_path(parent, parts, typename);
+    obj = object_resolve_abs_path(parent, parts, type_name);
 
     g_hash_table_iter_init(&iter, parent->properties);
     while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&prop)) {
@@ -2167,7 +2167,7 @@ static Object *object_resolve_partial_path(Object *parent,
         }
 
         found = object_resolve_partial_path(prop->opaque, parts,
-                                            typename, ambiguous);
+                                            type_name, ambiguous);
         if (found) {
             if (obj) {
                 *ambiguous = true;
@@ -2184,7 +2184,7 @@ static Object *object_resolve_partial_path(Object *parent,
     return obj;
 }
 
-Object *object_resolve_path_type(const char *path, const char *typename,
+Object *object_resolve_path_type(const char *path, const char *type_name,
                                  bool *ambiguousp)
 {
     Object *obj;
@@ -2196,12 +2196,12 @@ Object *object_resolve_path_type(const char *path, const char *typename,
     if (parts[0] == NULL || strcmp(parts[0], "") != 0) {
         bool ambiguous = false;
         obj = object_resolve_partial_path(object_get_root(), parts,
-                                          typename, &ambiguous);
+                                          type_name, &ambiguous);
         if (ambiguousp) {
             *ambiguousp = ambiguous;
         }
     } else {
-        obj = object_resolve_abs_path(object_get_root(), parts + 1, typename);
+        obj = object_resolve_abs_path(object_get_root(), parts + 1, type_name);
     }
 
     g_strfreev(parts);
@@ -2418,7 +2418,7 @@ static void property_set_enum(Object *obj, Visitor *v, const char *name,
 
 ObjectProperty *
 object_property_add_enum(Object *obj, const char *name,
-                         const char *typename,
+                         const char *type_name,
                          const QEnumLookup *lookup,
                          int (*get)(Object *, Error **),
                          void (*set)(Object *, int, Error **))
@@ -2429,7 +2429,7 @@ object_property_add_enum(Object *obj, const char *name,
     prop->get = get;
     prop->set = set;
 
-    return object_property_add(obj, name, typename,
+    return object_property_add(obj, name, type_name,
                                get ? property_get_enum : NULL,
                                set ? property_set_enum : NULL,
                                property_release_data,
@@ -2438,7 +2438,7 @@ object_property_add_enum(Object *obj, const char *name,
 
 ObjectProperty *
 object_class_property_add_enum(ObjectClass *klass, const char *name,
-                                    const char *typename,
+                                    const char *type_name,
                                     const QEnumLookup *lookup,
                                     int (*get)(Object *, Error **),
                                     void (*set)(Object *, int, Error **))
@@ -2449,7 +2449,7 @@ object_class_property_add_enum(ObjectClass *klass, const char *name,
     prop->get = get;
     prop->set = set;
 
-    return object_class_property_add(klass, name, typename,
+    return object_class_property_add(klass, name, type_name,
                                      get ? property_get_enum : NULL,
                                      set ? property_set_enum : NULL,
                                      NULL,
-- 
2.45.2.741.gdbec12cfda-goog



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] qom: Rename Object::class into Object::klass
  2024-06-24 20:43 [PATCH 1/2] qom: Rename Object::class into Object::klass Felix Wu
  2024-06-24 20:44 ` [PATCH 2/2] include/qom: Rename typename into type_name Felix Wu
@ 2024-06-25  2:20 ` Philippe Mathieu-Daudé
  2024-06-25  9:23   ` Peter Maydell
  2024-06-25  7:15 ` Daniel P. Berrangé
  2 siblings, 1 reply; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-06-25  2:20 UTC (permalink / raw)
  To: Felix Wu
  Cc: pbonzini, berrange, peter.maydell, eduardo, peterx, david,
	qemu-devel, Roman Kiryanov, Markus Armbruster

Hi Felix,

On 24/6/24 22:43, Felix Wu wrote:
> From: Roman Kiryanov <rkir@google.com>
> 
> 'class' is a C++ keyword and it prevents from
> using the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993

I asked Roman twice about this tag meaning:
https://lore.kernel.org/qemu-devel/e865d8e3-e768-4b1f-86d3-aeabe8f1d511@linaro.org/
https://lore.kernel.org/qemu-devel/09b7e7e1-30a6-49d0-a5f8-9cfc62884c55@linaro.org/
Since you are taking his work, do you mind clarifying?

Please include a cover letter for your series:
https://www.qemu.org/docs/master/devel/submitting-a-patch.html#include-a-meaningful-cover-letter

Also for headers refactors, enabling scripts/git.orderfile helps
reviewers.

Since you are posting different C++ enablement cleanups,
I suggest you add a section in our docs/devel/style.rst
requesting to keep headers C++ compatible, by not using
C++ reserved keywords, etc...
In particular because the mainstream project is not build-testing
for C++, thus we will likely merge patches breaking C++ and
make your life harder. That said, a C++ header smoke-build job
in our CI could help.

> Change-Id: I9ab7d2d77edef654a9c7b7cb9cd01795a6ed65a2
> Signed-off-by: Felix Wu <flwu@google.com>
> Signed-off-by: Roman Kiryanov <rkir@google.com>
> ---
>   hw/core/qdev-properties-system.c |  2 +-
>   include/exec/memory.h            |  2 +-
>   include/qom/object.h             |  2 +-
>   qom/object.c                     | 90 ++++++++++++++++----------------
>   4 files changed, 48 insertions(+), 48 deletions(-)


> diff --git a/include/qom/object.h b/include/qom/object.h
> index 13d3a655dd..7afdb261a8 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -153,7 +153,7 @@ struct ObjectClass
>   struct Object
>   {
>       /* private: */
> -    ObjectClass *class;
> +    ObjectClass *klass;
>       ObjectFree *free;
>       GHashTable *properties;
>       uint32_t ref;

I suppose the OBJECT_CLASS / OBJECT_CLASS_CHECK / OBJECT_GET_CLASS
macros aren't compiled so "class" isn't a problem there.

Since it isn't worst than our INTERFACE_CLASS() use:

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Regards,

Phil.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] qom: Rename Object::class into Object::klass
  2024-06-24 20:43 [PATCH 1/2] qom: Rename Object::class into Object::klass Felix Wu
  2024-06-24 20:44 ` [PATCH 2/2] include/qom: Rename typename into type_name Felix Wu
  2024-06-25  2:20 ` [PATCH 1/2] qom: Rename Object::class into Object::klass Philippe Mathieu-Daudé
@ 2024-06-25  7:15 ` Daniel P. Berrangé
  2 siblings, 0 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2024-06-25  7:15 UTC (permalink / raw)
  To: Felix Wu
  Cc: peter.maydell, pbonzini, eduardo, peterx, david, philmd,
	qemu-devel, Roman Kiryanov

On Mon, Jun 24, 2024 at 08:43:59PM +0000, Felix Wu wrote:
> From: Roman Kiryanov <rkir@google.com>
> 
> 'class' is a C++ keyword and it prevents from
> using the QEMU headers with a C++ compiler.
> 
> Google-Bug-Id: 331190993
> Change-Id: I9ab7d2d77edef654a9c7b7cb9cd01795a6ed65a2

Please remove both of these lines when posting patches. They are
irrelevant to QEMU's git commit history.

> Signed-off-by: Felix Wu <flwu@google.com>
> Signed-off-by: Roman Kiryanov <rkir@google.com>
> ---
>  hw/core/qdev-properties-system.c |  2 +-
>  include/exec/memory.h            |  2 +-
>  include/qom/object.h             |  2 +-
>  qom/object.c                     | 90 ++++++++++++++++----------------
>  4 files changed, 48 insertions(+), 48 deletions(-)

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] qom: Rename Object::class into Object::klass
  2024-06-25  2:20 ` [PATCH 1/2] qom: Rename Object::class into Object::klass Philippe Mathieu-Daudé
@ 2024-06-25  9:23   ` Peter Maydell
  2024-06-25  9:36     ` Daniel P. Berrangé
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Maydell @ 2024-06-25  9:23 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: Felix Wu, pbonzini, berrange, eduardo, peterx, david, qemu-devel,
	Roman Kiryanov, Markus Armbruster

On Tue, 25 Jun 2024 at 03:20, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> Since you are posting different C++ enablement cleanups,
> I suggest you add a section in our docs/devel/style.rst
> requesting to keep headers C++ compatible, by not using
> C++ reserved keywords, etc...
>
> In particular because the mainstream project is not build-testing
> for C++, thus we will likely merge patches breaking C++ and
> make your life harder. That said, a C++ header smoke-build job
> in our CI could help.

Unless there's some easy mechanism for contributors to check
that they haven't broken whatever our C++ requirement is,
I don't think we should define it in the style guide.

More generally, we specifically removed the handling we
had for being able to include our headers from C++ source
files. (cf the stuff we added in commit 875df03b221 for
extern "C" blocks and then removed again later). If we're
not bringing that back (and I don't think we should) then
we're not actually trying to have our headers be C++
compatible, so what are we aiming for?

thanks
-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] qom: Rename Object::class into Object::klass
  2024-06-25  9:23   ` Peter Maydell
@ 2024-06-25  9:36     ` Daniel P. Berrangé
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2024-06-25  9:36 UTC (permalink / raw)
  To: Peter Maydell
  Cc: Philippe Mathieu-Daudé, Felix Wu, pbonzini, eduardo, peterx,
	david, qemu-devel, Roman Kiryanov, Markus Armbruster

On Tue, Jun 25, 2024 at 10:23:54AM +0100, Peter Maydell wrote:
> On Tue, 25 Jun 2024 at 03:20, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
> > Since you are posting different C++ enablement cleanups,
> > I suggest you add a section in our docs/devel/style.rst
> > requesting to keep headers C++ compatible, by not using
> > C++ reserved keywords, etc...
> >
> > In particular because the mainstream project is not build-testing
> > for C++, thus we will likely merge patches breaking C++ and
> > make your life harder. That said, a C++ header smoke-build job
> > in our CI could help.
> 
> Unless there's some easy mechanism for contributors to check
> that they haven't broken whatever our C++ requirement is,
> I don't think we should define it in the style guide.
> 
> More generally, we specifically removed the handling we
> had for being able to include our headers from C++ source
> files. (cf the stuff we added in commit 875df03b221 for
> extern "C" blocks and then removed again later). If we're
> not bringing that back (and I don't think we should) then
> we're not actually trying to have our headers be C++
> compatible, so what are we aiming for?

I really dislike the drip-feeding of patches fixing C++ related
problems. As maintainers we've no idea what the end state is,
is this the last patch, or are there another 100 of these patches
to trickle out one at a time. Ultimately from the QEMU maintainer
POV anything related to C++ compatibility is a distraction, given
the general consensus has turned to Rust as the future for QEMU,
not C++.

If we're going to take any C++ compat cleanups as a courtesy to
ease burden of a downstream fork, then I'd like to see a complete
series in one go, so we can sensibly evaluate whether the end
state is something desirable from QEMU's POV.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-06-25  9:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-24 20:43 [PATCH 1/2] qom: Rename Object::class into Object::klass Felix Wu
2024-06-24 20:44 ` [PATCH 2/2] include/qom: Rename typename into type_name Felix Wu
2024-06-25  2:20 ` [PATCH 1/2] qom: Rename Object::class into Object::klass Philippe Mathieu-Daudé
2024-06-25  9:23   ` Peter Maydell
2024-06-25  9:36     ` Daniel P. Berrangé
2024-06-25  7:15 ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).