Re: [Qemu-block] [Qemu-devel] [PATCH 0/4] qapi/error: converts error_setg(_fatal) to error_report() + exit()

2018-06-07 Thread Markus Armbruster
Philippe Mathieu-Daudé  writes:

> Hi,
>
> This series converts error_setg(_fatal) to error_report() + exit() as
> suggested by the "qapi/error.h" documentation.

Appreciated!

The series actually converts two anti-patterns.

1. From

if (COND) {
error_setg(_fatal, ...);
}

to

if (COND) {
error_report(...);
exit(1);
}

This is exactly what error.h asks for.

2. From

if (COND) {
error_setg(_abort, ...);
}
to

if (COND) {
error_report(...);
abort();
}

error.h asks for

assert(!COND);

instead.  See my reply to PATCH 1 for why.



Re: [Qemu-block] [Qemu-devel] [PATCH 0/4] qapi/error: converts error_setg(_fatal) to error_report() + exit()

2018-05-29 Thread Auger Eric
Hi,

On 05/29/2018 07:48 PM, Philippe Mathieu-Daudé wrote:
> Hi,
> 
> This series converts error_setg(_fatal) to error_report() + exit() as
> suggested by the "qapi/error.h" documentation.
> 
> This reduce Coverity and Clang static analyzer positive falses.
> 
> See http://lists.nongnu.org/archive/html/qemu-devel/2017-07/msg07585.html:
> 
> On 07/24/2017 04:52 PM, Eric Blake wrote:
> That's a shame.  Rather, we should patch this file (and others) to avoid
> all the inconsistent uses of error_setg(_*), to comply with the
> error.h documentation.

Thanks for the fix.

For the series:
Reviewed-by: Eric Auger 

Thanks

Eric

> 
> Regards,
> 
> Phil.
> 
> Philippe Mathieu-Daudé (4):
>   hw/block/fdc: Replace error_setg(_abort) by error_report() + abort()
>   hw/ppc/spapr_drc: Replace error_setg(_abort) by error_report() +
> abort()
>   hw/arm/sysbus-fdt: Replace error_setg(_fatal) by error_report()
> + exit()
>   device_tree: Replace error_setg(_fatal) by error_report() + exit()
> 
>  device_tree.c   | 23 +--
>  hw/arm/sysbus-fdt.c | 45 ++---
>  hw/block/fdc.c  |  7 ---
>  hw/ppc/spapr_drc.c  |  3 ++-
>  4 files changed, 45 insertions(+), 33 deletions(-)
>