qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 4/4] qom: Warn when deprecated class property can be remo


From: Bernhard Beschow
Subject: Re: [RFC PATCH 4/4] qom: Warn when deprecated class property can be removed
Date: Tue, 10 Jan 2023 09:34:36 +0000


Am 9. Januar 2023 22:54:19 UTC schrieb "Philippe Mathieu-Daudé" 
<philmd@linaro.org>:
>Per docs/system/deprecated.rst, a deprecated feature can be
>removed after 2 releases. Since we commit when a class property
>is deprecated, we can warn when the deprecation period is over.
>
>See also commit ef1f5b0a96 ("docs: clarify deprecation schedule").
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> qom/object.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
>diff --git a/qom/object.c b/qom/object.c
>index 05b97cd424..cb829f1e44 100644
>--- a/qom/object.c
>+++ b/qom/object.c
>@@ -17,6 +17,7 @@
> #include "qom/object_interfaces.h"
> #include "qemu/cutils.h"
> #include "qemu/memalign.h"
>+#include "qemu/qemu-version.h"
> #include "qapi/visitor.h"
> #include "qapi/string-input-visitor.h"
> #include "qapi/string-output-visitor.h"
>@@ -1300,6 +1301,12 @@ void object_class_property_deprecate(ObjectClass *klass,
>     ObjectProperty *prop = object_class_property_find(klass, name);
> 
>     assert(prop);
>+    if (qemu_version_delta_current(version_major, version_minor) <= 2) {
>+        warn_report_once("Property '%s.%s' has been deprecated in release"
>+                         " v%u.%u and can be removed.",
>+                         object_class_get_name(klass), name,
>+                         version_major, version_minor);
>+    }
>     prop->deprecation_reason = reason;
> }
> 

Great series!

Perhaps turn object_class_property_deprecate() into a macro and warn at compile 
time already? That way we won't miss removing any properties and users won't 
see a warning they can't do anything about.

Best regards,
Bernhard



reply via email to

[Prev in Thread] Current Thread [Next in Thread]