qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 01/31] Use error_fatal to simplify obvious fatal


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH 01/31] Use error_fatal to simplify obvious fatal errors (again)
Date: Thu, 11 Oct 2018 19:25:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Eric Blake <address@hidden> writes:

> On 10/8/18 12:30 PM, Markus Armbruster wrote:
>> Add a slight improvement of the Coccinelle semantic patch from commit
>> 07d04a0219b,
>
> which shares the same commit title, but does not actually have a
> semantic patch, but rather defers to the even older 007b065.  But I'm
> not too worried about either the duplicated commit title nor the chain
> of references to follow - as this is a no-semantic-change patch rather
> than a bugfix, it's less likely to cause confusion to any downstream
> backport efforts.

I'm changing the reference to 007b06578ab anyway.

>> and use it to clean up.  It leaves dead Error * variables
>> behind, cleaned up manually.
>
> Coccinelle can handle that too, if we want to make the .cocci file
> longer (but off-hand, I don't remember the exact semantic patch
> formula to express a variable that is initialized but then never used,
> as a result of applying earlier semantic patches). So the manual
> cleanup for now still seems tractable.

We can track down the recipe when the manual cleanup becomes tiresome.

>>
>> Cc: David Gibson <address@hidden>
>> Cc: Alexander Graf <address@hidden>
>> Cc: Eric Blake <address@hidden>
>> Cc: Paolo Bonzini <address@hidden>
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>   hw/intc/xics_kvm.c                       |  7 +------
>>   qemu-nbd.c                               |  6 +-----
>>   scripts/coccinelle/use-error_fatal.cocci | 20 ++++++++++++++++++++
>>   vl.c                                     |  7 +------
>>   4 files changed, 23 insertions(+), 17 deletions(-)
>>   create mode 100644 scripts/coccinelle/use-error_fatal.cocci
>>
>
>> +++ b/scripts/coccinelle/use-error_fatal.cocci
>> @@ -0,0 +1,20 @@
>> +@@
>> +type T;
>> +identifier FUN, RET;
>> +expression list ARGS;
>> +expression ERR, EC, FAIL;
>
> The slight improvement from the original git commit log script is the
> addition of FAIL,
>
>> +@@
>> +(
>> +-    T RET = FUN(ARGS, &ERR);
>> ++    T RET = FUN(ARGS, &error_fatal);
>> +|
>> +-    RET = FUN(ARGS, &ERR);
>> ++    RET = FUN(ARGS, &error_fatal);
>> +|
>> +-    FUN(ARGS, &ERR);
>> ++    FUN(ARGS, &error_fatal);
>> +)
>> +-    if (FAIL) {
>
> and a check for arbitrary condition FAIL rather than a more specific
> ERR != NULL.  Makes sense.

Yes.

>> +-        error_report_err(ERR);
>> +-        exit(EC);
>> +-    }
>
> Reviewed-by: Eric Blake <address@hidden>

Thanks!



reply via email to

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