From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zov6b-0002BJ-AZ for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:15:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zov6X-0005LL-94 for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:15:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zov6X-0005Kv-4m for qemu-devel@nongnu.org; Wed, 21 Oct 2015 11:15:05 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 8E766221 for ; Wed, 21 Oct 2015 15:15:04 +0000 (UTC) References: <8737x4p8l9.fsf@fimbulvetr.bsc.es> From: Eric Blake Message-ID: <5627ABF3.10408@redhat.com> Date: Wed, 21 Oct 2015 09:14:59 -0600 MIME-Version: 1.0 In-Reply-To: <8737x4p8l9.fsf@fimbulvetr.bsc.es> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="gxKHnD1WCsS7nmhFXuCC7TAXLlpQCqrNO" Subject: Re: [Qemu-devel] Coding style for errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gxKHnD1WCsS7nmhFXuCC7TAXLlpQCqrNO Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/21/2015 09:03 AM, Llu=C3=ADs Vilanova wrote: > Hi, >=20 > I was wondering what is the proper way (or ways, depending on the subsy= stem) 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: >=20 > * printf + exit(1) > * fprintf(stderr) + exit(1) Existing code doesn't all have to be switched, but new code... > * error_report + exit(1) =2E..should favor this approach, or even: error_setg(..., &error_fatal) as shorthand. > * cpu_abort > * Some other I probably forgot >=20 > So, is there any agreement on what should be used? If so, could that pl= ease 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? --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --gxKHnD1WCsS7nmhFXuCC7TAXLlpQCqrNO Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWJ6vzAAoJEKeha0olJ0Nq74gH/12eSSC1hqXSBj5L4CSzffhS vqdp6IZw3H63Hv8qMgXbDNhxcNnn3E5fFrtYRpE6WXbDSx+Pv9m106YeSYeMal6e piQpG2c9cGsPdx6w6Rfz0xysYxkyceTO8RnPVp+JCWhZau1XDf8fdDcGbQm3Vw2C jjxgki2fBI0VQ/ksExLV1Q9A/+KtRHB33Li+0XSLLJMq1uQjJ4CJg4qrKXqJoIb+ mfbA8ZPdtfJOb5Mw9Bw2ghCQpIU9fy/dLHKQeexD2gz345jl610JrnPdHBJbXUBg Sd+r+Ks7UHC47MmRG3KH7JsS4m93O7b3AWp4+JmT7wrHqQmPlS7RlIUgkCj86Kc= =yhoN -----END PGP SIGNATURE----- --gxKHnD1WCsS7nmhFXuCC7TAXLlpQCqrNO--