From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53634) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buZgC-000225-QI for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:39:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buZg9-0005d6-MS for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:39:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36872) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buZg9-0005ch-Fy for qemu-devel@nongnu.org; Thu, 13 Oct 2016 02:39:45 -0400 From: Markus Armbruster References: <57FE5B29.4040808@virtuozzo.com> <14e53dd6-3ce9-70a2-21f8-6110a1bc970d@redhat.com> Date: Thu, 13 Oct 2016 08:39:42 +0200 In-Reply-To: <14e53dd6-3ce9-70a2-21f8-6110a1bc970d@redhat.com> (Eric Blake's message of "Wed, 12 Oct 2016 15:55:45 -0500") Message-ID: <87r37kg3bl.fsf@dusky.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] error reporting in functions List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Vladimir Sementsov-Ogievskiy , qemu-devel Eric Blake writes: > On 10/12/2016 10:47 AM, Vladimir Sementsov-Ogievskiy wrote: >> HI all! >> >> My questions is: what are general recommendations in Qemu for return >> code, if we have Error **errp? >> What should I prefer: errp, duplicated by int return code, or void >> functions with errp? > > Markus has already had several threads commenting on this very topic in > the past. A lot of code uses void return, but some newer code is using A recent one: Message-ID: <87a8ekfenp.fsf@dusky.pond.sub.org> http://lists.gnu.org/archive/html/qemu-devel/2016-10/msg00435.html > the past. A lot of code uses void return, but some newer code is using > an int return for simplifying the call-sites (and glib prefers the int > rather than void return, as well). Markus was playing with a Coccinelle > script to see how painful a bulk-conversion of the code base would be, > but it is probably stalled behind more pressing work at the moment. Correct. >> void + errp seems good, just to not duplicate things. But it has a >> disadvantage of necessity of "local_err" and "error_propagate" in caller >> function, if its behaviour depends on callee function success...