[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
- [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Philippe Mathieu-Daudé, 2023/01/09
- [RFC PATCH 1/4] qom: Introduce object_class_property_deprecate(), Philippe Mathieu-Daudé, 2023/01/09
- [RFC PATCH 2/4] hw/block: Rename TYPE_PFLASH_CFI02 'width' property as 'device-width', Philippe Mathieu-Daudé, 2023/01/09
- [RFC PATCH 3/4] util: Introduce helpers to compare QEMU versions, Philippe Mathieu-Daudé, 2023/01/09
- [RFC PATCH 4/4] qom: Warn when deprecated class property can be removed, Philippe Mathieu-Daudé, 2023/01/09
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Kevin Wolf, 2023/01/10
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Philippe Mathieu-Daudé, 2023/01/11
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Daniel P . Berrangé, 2023/01/11
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Philippe Mathieu-Daudé, 2023/01/11
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Daniel P . Berrangé, 2023/01/11
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Markus Armbruster, 2023/01/11
- Re: [RFC PATCH 0/4] qom: Introduce object_class_property_deprecate(), Philippe Mathieu-Daudé, 2023/01/11