qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [Qemu-arm] [PATCH v2 1/2] Use error_fatal to simplify o


From: Markus Armbruster
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH v2 1/2] Use error_fatal to simplify obvious fatal errors
Date: Wed, 16 Dec 2015 08:43:16 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

Peter Maydell <address@hidden> writes:

> On 14 December 2015 at 19:25, Markus Armbruster <address@hidden> wrote:
>> Eduardo Habkost <address@hidden> writes:
>>
>>> On Thu, Dec 10, 2015 at 05:29:14PM +0100, Markus Armbruster wrote:
>>>> Done with this admittedly crude Coccinelle semantic patch:
>>>>
>>>
>>> Reviewed-by: Eduardo Habkost <address@hidden>
>>>
>>> You can rewrite the semantic patch as:
> [...]
>>> Coccinelle seems to have some magic to make "LIST," also match
>>> with an empty list.
>>
>> Same output as my script, except it doesn't mess up zynq_init().  Sold!
>
> Do you mean by this that you're planning to send a v3, or would you
> like me to apply v2 to target-arm.next?

I only changed PATCH 1's commit message since v2 (current version
appended).  I plan to include the series in a pull request in my role as
error reporting maintainer, but I don't mind "losing" patches to other
maintainers on the way.


Use error_fatal to simplify obvious fatal errors

Done with this Coccinelle semantic patch:

    @@
    type T;
    identifier FUN, RET;
    expression list ARGS;
    expression ERR, EC;
    @@
    (
    -    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 (ERR != NULL) {
    -        error_report_err(ERR);
    -        exit(EC);
    -    }

This is actually a more elegant version of my initial semantic patch
by courtesy of Eduardo.

It leaves dead Error * variables behind, cleaned up manually.

Cc: address@hidden
Cc: "Michael S. Tsirkin" <address@hidden>
Cc: Eduardo Habkost <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Eduardo Habkost <address@hidden>



reply via email to

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