qemu-ppc
[Top][All Lists]
Advanced

[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>




reply via email to

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