[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (c
From: |
Zhao Liu |
Subject: |
Re: [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value) |
Date: |
Tue, 12 Mar 2024 23:18:11 +0800 |
On Tue, Mar 12, 2024 at 03:13:39PM +0100, Markus Armbruster wrote:
> Date: Tue, 12 Mar 2024 15:13:39 +0100
> From: Markus Armbruster <armbru@redhat.com>
> Subject: [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition
> (constant value)
>
> From: Philippe Mathieu-Daudé <philmd@linaro.org>
>
> Address the comment added in commit 4629ed1e98
> ("qerror: Finally unused, clean up"), from 2015:
>
> /*
> * These macros will go away, please don't use
> * in new code, and do not add new ones!
> */
>
> Mechanical transformation using the following
> coccinelle semantic patch:
>
> @match@
> expression errp;
> expression param;
> constant value;
> @@
> error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value);
>
> @script:python strformat depends on match@
> value << match.value;
> fixedfmt; // new var
> @@
> fixedfmt = f'"Invalid parameter type for \'%s\', expected: {value[1:-1]}"'
> coccinelle.fixedfmt = cocci.make_ident(fixedfmt)
>
> @replace@
> expression match.errp;
> expression match.param;
> constant match.value;
> identifier strformat.fixedfmt;
> @@
> - error_setg(errp, QERR_INVALID_PARAMETER_TYPE, param, value);
> + error_setg(errp, fixedfmt, param);
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> qapi/qobject-input-visitor.c | 32 ++++++++++++++++----------------
> qapi/string-input-visitor.c | 8 ++++----
> qom/object.c | 12 ++++++++----
> 3 files changed, 28 insertions(+), 24 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
- [PATCH 00/10] Reduce usage of QERR_ macros further, Markus Armbruster, 2024/03/12
- [PATCH 01/10] error: Drop superfluous #include "qapi/qmp/qerror.h", Markus Armbruster, 2024/03/12
- [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value), Markus Armbruster, 2024/03/12
- Re: [PATCH 06/10] qapi: Inline QERR_INVALID_PARAMETER_TYPE definition (constant value),
Zhao Liu <=
- [PATCH 02/10] qapi: Inline and remove QERR_BUS_NO_HOTPLUG definition, Markus Armbruster, 2024/03/12
- [PATCH 04/10] qapi: Inline and remove QERR_DEVICE_NO_HOTPLUG definition, Markus Armbruster, 2024/03/12
- [PATCH 07/10] qapi: Inline and remove QERR_INVALID_PARAMETER_TYPE definition, Markus Armbruster, 2024/03/12
- [PATCH 10/10] qapi: Inline and remove QERR_PROPERTY_VALUE_BAD definition, Markus Armbruster, 2024/03/12
- [PATCH 09/10] qapi: Inline and remove QERR_MIGRATION_ACTIVE definition, Markus Armbruster, 2024/03/12