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

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to