Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-07-03 Thread Eduardo Habkost
On Mon, Jul 03, 2017 at 03:21:56PM +0200, Markus Armbruster wrote: > Eduardo Habkost writes: > > > On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote: > > [...] > >> > >> I doubt the macros make the bug fixing materially easier, and I doubt > >> they can reduce future bugs of this

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-07-03 Thread Markus Armbruster
Eduardo Habkost writes: > On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote: > [...] >> >> I doubt the macros make the bug fixing materially easier, and I doubt >> they can reduce future bugs of this kind. What they can do is letting >> us get rid of error_propagate() boilerplat

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-07-03 Thread Markus Armbruster
Eduardo Habkost writes: > On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote: >> Eduardo Habkost writes: >> >> > On Thu, Jun 29, 2017 at 08:54:29AM +0200, Markus Armbruster wrote: >> >> Eduardo Habkost writes: >> >> >> >> > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbr

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-07-01 Thread Eduardo Habkost
On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote: [...] > > I doubt the macros make the bug fixing materially easier, and I doubt > they can reduce future bugs of this kind. What they can do is letting > us get rid of error_propagate() boilerplate with relative ease. > > If we s

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-07-01 Thread Eduardo Habkost
On Fri, Jun 30, 2017 at 01:40:58PM +0200, Markus Armbruster wrote: > Eduardo Habkost writes: > > > On Thu, Jun 29, 2017 at 08:54:29AM +0200, Markus Armbruster wrote: > >> Eduardo Habkost writes: > >> > >> > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: > >> >> Eduardo Habko

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-30 Thread Markus Armbruster
Eduardo Habkost writes: > On Thu, Jun 29, 2017 at 08:54:29AM +0200, Markus Armbruster wrote: >> Eduardo Habkost writes: >> >> > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: >> >> Eduardo Habkost writes: > [...] >> >> > I understand the reason we need to support errp==NULL

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Daniel P. Berrange
On Thu, Jun 29, 2017 at 02:47:34PM -0300, Eduardo Habkost wrote: > On Thu, Jun 29, 2017 at 06:38:50PM +0100, Daniel P. Berrange wrote: > > On Thu, Jun 29, 2017 at 02:09:39PM -0300, Eduardo Habkost wrote: > > > On Thu, Jun 29, 2017 at 03:18:05PM +0100, Daniel P. Berrange wrote: > > > > On Thu, Jun 2

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Eduardo Habkost
On Thu, Jun 29, 2017 at 06:38:50PM +0100, Daniel P. Berrange wrote: > On Thu, Jun 29, 2017 at 02:09:39PM -0300, Eduardo Habkost wrote: > > On Thu, Jun 29, 2017 at 03:18:05PM +0100, Daniel P. Berrange wrote: > > > On Thu, Jun 29, 2017 at 03:39:58PM +0200, Paolo Bonzini wrote: > > > > On 28/06/2017 1

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Daniel P. Berrange
On Thu, Jun 29, 2017 at 02:09:39PM -0300, Eduardo Habkost wrote: > On Thu, Jun 29, 2017 at 03:18:05PM +0100, Daniel P. Berrange wrote: > > On Thu, Jun 29, 2017 at 03:39:58PM +0200, Paolo Bonzini wrote: > > > On 28/06/2017 11:05, Markus Armbruster wrote: > > > > If foo() additionally returned an ind

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Eduardo Habkost
On Thu, Jun 29, 2017 at 03:18:05PM +0100, Daniel P. Berrange wrote: > On Thu, Jun 29, 2017 at 03:39:58PM +0200, Paolo Bonzini wrote: > > On 28/06/2017 11:05, Markus Armbruster wrote: > > > If foo() additionally returned an indication of success, you could write > > > > > > if (!foo(arg, errp

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Daniel P. Berrange
On Thu, Jun 29, 2017 at 03:39:58PM +0200, Paolo Bonzini wrote: > On 28/06/2017 11:05, Markus Armbruster wrote: > > If foo() additionally returned an indication of success, you could write > > > > if (!foo(arg, errp)) {// assuming foo() returns a bool > > handle the error... > >

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Daniel P. Berrange
On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: > Eduardo Habkost writes: > > > Rationale > > - > > > > I'm often bothered by the fact that we can't write the following: > > > > foo(arg, errp); > > if (*errp) { > > handle the error... > > error_p

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Daniel P. Berrange
On Wed, Jun 28, 2017 at 02:41:58PM -0300, Eduardo Habkost wrote: > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: > > > Ensuring errp is never NULL > > > --- > > > > > > The last patch on this series changes the (Error **errp) > > > parameters in functio

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Paolo Bonzini
On 28/06/2017 11:05, Markus Armbruster wrote: > If foo() additionally returned an indication of success, you could write > > if (!foo(arg, errp)) {// assuming foo() returns a bool > handle the error... > } > > Nicely concise. > > For what it's worth, this is how GLib wa

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-29 Thread Eduardo Habkost
On Thu, Jun 29, 2017 at 08:54:29AM +0200, Markus Armbruster wrote: > Eduardo Habkost writes: > > > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: > >> Eduardo Habkost writes: [...] > >> > I understand the reason we need to support errp==NULL, as it > >> > makes life simpler f

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-28 Thread Markus Armbruster
Eduardo Habkost writes: > On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: >> Eduardo Habkost writes: >> >> > Rationale >> > - >> > >> > I'm often bothered by the fact that we can't write the following: >> > >> > foo(arg, errp); >> > if (*errp) { >> > h

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-28 Thread Eduardo Habkost
On Wed, Jun 28, 2017 at 11:05:26AM +0200, Markus Armbruster wrote: > Eduardo Habkost writes: > > > Rationale > > - > > > > I'm often bothered by the fact that we can't write the following: > > > > foo(arg, errp); > > if (*errp) { > > handle the error... > > error_p

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-28 Thread Markus Armbruster
Eduardo Habkost writes: > Rationale > - > > I'm often bothered by the fact that we can't write the following: > > foo(arg, errp); > if (*errp) { > handle the error... > error_propagate(errp, err); > } > > because errp can be NULL. If foo() additionally returne

Re: [Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-27 Thread Eric Blake
On 06/13/2017 11:52 AM, Eduardo Habkost wrote: > The Proposal > > > I'm proposing replacing NULL errp with a special macro: > IGNORE_ERRORS. The macro will trigger special behavior in the > error API that will make it not save any error information in the > error pointer, but still

[Qemu-devel] [RFC 00/15] Error API: Flag errors in *errp even if errors are being ignored

2017-06-13 Thread Eduardo Habkost
Rationale - I'm often bothered by the fact that we can't write the following: foo(arg, errp); if (*errp) { handle the error... error_propagate(errp, err); } because errp can be NULL. I understand the reason we need to support errp==NULL, as it makes life simp