From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48965) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0xrE-0006qv-ER for qemu-devel@nongnu.org; Mon, 23 Nov 2015 15:37:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0xr9-0004Vg-VO for qemu-devel@nongnu.org; Mon, 23 Nov 2015 15:37:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0xr9-0004Uy-Q4 for qemu-devel@nongnu.org; Mon, 23 Nov 2015 15:36:59 -0500 Date: Mon, 23 Nov 2015 20:36:54 +0000 From: "Daniel P. Berrange" Message-ID: <20151123203654.GY18085@redhat.com> References: <144830407261.1693.6845199723252391860.stgit@localhost> <144830408403.1693.5595372859320618258.stgit@localhost> <20151123185116.GV18085@redhat.com> <87twocfpmd.fsf@fimbulvetr.bsc.es> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <87twocfpmd.fsf@fimbulvetr.bsc.es> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 2/2] doc: Introduce coding style for errors Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Thomas Huth , qemu-devel@nongnu.org, Markus Armbruster , "Dr . David Alan Gilbert" On Mon, Nov 23, 2015 at 09:05:30PM +0100, Llu=C3=ADs Vilanova wrote: > Daniel P Berrange writes: > [...] > > I don't think this "Errors in user inputs" vs "Other errors" distinct= ion > > really makes sense. Whether an error raised in a piece of code is rel= ated > > to user input or not is almost impossible to determine in practice. S= o as > > a rule to follow it is not practical. >=20 > > AFAIK, include/qemu/error-report.h is the historical failed experimen= t > > in structured error reporting, while include/qapi/error.h is the new > > preferred error reporting system that everything should be using. >=20 > > On this basis, I'd simply say that include/qemu/error-report.h is > > legacy code that should no longer be used, and that new code should > > use include/qapi/error.h exclusively and existing code converted > > where practical. >=20 > Mmmm, I've just reviewed both headers and you sound partially right. >=20 > AFAIU, "qemu/error-report.h" contains the additional logic to manage "i= nput > locations", not present anywhere else. Also, you state that only the re= porting > functions in "qemu/error.h" should be used. >=20 > Since "qemu/error.h" internally uses 'error_report()' (from > "qemu/error-report.h"), it includes the input location information (if = any). So, > I will simply refer to "qemu/error.h" for the general reporting functio= ns, plus > the location management functions in "qemu/error-report.h". I don't think the location management functions need to be pointed out as broadly speaking, no patches ever need to use them. It should be sufficient to just describe the new error reporting functions in no new code will ever want to use them in general. Really we only need document the qapi/error.h functions and tell people not to use anything else Regards, Daniel --=20 |: http://berrange.com -o- http://www.flickr.com/photos/dberrange= / :| |: http://libvirt.org -o- http://virt-manager.or= g :| |: http://autobuild.org -o- http://search.cpan.org/~danberr= / :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vn= c :|