[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Coding style for errors
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] Coding style for errors |
Date: |
Wed, 21 Oct 2015 09:14:59 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 10/21/2015 09:03 AM, Lluís Vilanova wrote:
> Hi,
>
> I was wondering what is the proper way (or ways, depending on the subsystem)
> of
> reporting and signalling errors in QEMU. The coding style file does not seem
> to
> mention it, and the code uses all kinds of forms for that:
>
> * printf + exit(1)
> * fprintf(stderr) + exit(1)
Existing code doesn't all have to be switched, but new code...
> * error_report + exit(1)
...should favor this approach, or even:
error_setg(..., &error_fatal)
as shorthand.
> * cpu_abort
> * Some other I probably forgot
>
> So, is there any agreement on what should be used? If so, could that please be
> added to CODING_STYLE?
include/qapi/error.h has more documentation on how to best use struct
Error and the various error_* functions, but you're right that a blurb
in CODING_STYLE can't hurt. Would you care to try writing a first draft?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature