From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] Coding style for errors
Date: Wed, 21 Oct 2015 09:14:59 -0600 [thread overview]
Message-ID: <5627ABF3.10408@redhat.com> (raw)
In-Reply-To: <8737x4p8l9.fsf@fimbulvetr.bsc.es>
[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]
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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2015-10-21 15:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-21 15:03 [Qemu-devel] Coding style for errors Lluís Vilanova
2015-10-21 15:14 ` Eric Blake [this message]
2015-10-21 19:41 ` Lluís Vilanova
2015-10-21 16:48 ` Markus Armbruster
2015-10-21 20:16 ` Peter Maydell
2015-10-22 13:30 ` Lluís Vilanova
2015-10-23 16:01 ` Stefan Hajnoczi
2015-10-23 16:12 ` Laszlo Ersek
2015-10-23 17:02 ` Dr. David Alan Gilbert
2015-10-28 16:44 ` Thomas Huth
2015-10-23 17:34 ` Lluís Vilanova
2015-10-26 11:39 ` Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5627ABF3.10408@redhat.com \
--to=eblake@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.