All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@gmail.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	"Lluís Vilanova" <vilanova@ac.upc.edu>
Subject: Re: [Qemu-devel] [PATCH v6 1/5] util: Introduce error reporting functions with fatal/abort
Date: Wed, 3 Feb 2016 16:04:36 +1100	[thread overview]
Message-ID: <20160203050436.GI15080@voom.fritz.box> (raw)
In-Reply-To: <56B123F7.50505@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 2234 bytes --]

On Tue, Feb 02, 2016 at 10:47:35PM +0100, Thomas Huth wrote:
> On 02.02.2016 19:53, Markus Armbruster wrote:
> > Lluís Vilanova <vilanova@ac.upc.edu> writes:
> ...
> 
> >> diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
> >> index 7ab2355..6c2f142 100644
> >> --- a/include/qemu/error-report.h
> >> +++ b/include/qemu/error-report.h
> >> @@ -43,4 +43,23 @@ void error_report(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
> >>  const char *error_get_progname(void);
> >>  extern bool enable_timestamp_msg;
> >>  
> >> +/* Report message and exit with error */
> >> +void QEMU_NORETURN error_vreport_fatal(const char *fmt, va_list ap) GCC_FMT_ATTR(1, 0);
> >> +void QEMU_NORETURN error_report_fatal(const char *fmt, ...) GCC_FMT_ATTR(1, 2);
> > 
> > This lets people write things like
> > 
> >     error_report_fatal("The sky is falling");
> > 
> > instead of
> > 
> >     error_report("The sky is falling");
> >     exit(1);
> > 
> > or
> > 
> >     fprintf(stderr, "The sky is falling\n");
> >     exit(1);
> > 
> > I don't think that's an improvement in clarity.
> 
> The problem is not the existing code, but that in a couple of new
> patches, I've now already seen that people are trying to use
> 
>      error_setg(&error_fatal, ... );

So, I don't actually see any real advantage to error_report_fatal(...)
over error_setg(&error_fatal, ...).

> to do error reporting - which is IMHO the most ugliest way to do this,
> because I'd really not expect error_setg() to (always) exit QEMU when I
> quickly read through the sources.
> We fortunately do not have that in the sources yet (only some few spots
> with error_abort), but to prevent that people start using that, it would
> be good to have a error_report_fatal() function instead, I think.
> 
> Alternatively, if you really want to see the exit(1) in the sources, I
> think this should be mentioned in the coding guidelines ... or are you
> fine with error_setg(&error_fatal, ...), Markus?
> 
>  Thomas
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-02-03  5:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 16:13 [Qemu-devel] [RFC][PATCH v6 0/5] utils: Improve and document error reporting Lluís Vilanova
2016-02-02 16:13 ` [Qemu-devel] [PATCH v6 1/5] util: Introduce error reporting functions with fatal/abort Lluís Vilanova
2016-02-02 18:53   ` Markus Armbruster
2016-02-02 21:47     ` Thomas Huth
2016-02-03  5:04       ` David Gibson [this message]
2016-02-03  9:48         ` Markus Armbruster
2016-02-03  9:58           ` Thomas Huth
2016-02-03 10:38             ` Markus Armbruster
2016-02-03 13:42               ` Lluís Vilanova
2016-02-03 14:34                 ` Markus Armbruster
2016-02-03 15:11                   ` Lluís Vilanova
2016-02-03 18:06                     ` Markus Armbruster
2016-02-03 22:23           ` David Gibson
2016-02-03  7:26       ` Markus Armbruster
2016-02-03 17:59     ` Lluís Vilanova
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 2/5] util: Use new error_report_fatal/abort instead of error_setg(&error_fatal/abort) Lluís Vilanova
2016-02-02 20:16   ` John Snow
2016-02-02 16:14 ` [PATCH v6 3/5] util: [ppc] Use new error_report_fatal() instead of exit() Lluís Vilanova
2016-02-02 16:14   ` [Qemu-devel] " Lluís Vilanova
2016-02-02 16:14 ` [PATCH v6 4/5] util: [ppc] Use new error_report_abort() instead of abort() Lluís Vilanova
2016-02-02 16:14   ` [Qemu-devel] " Lluís Vilanova
2016-02-02 19:34   ` Eric Blake
2016-02-02 19:34     ` [Qemu-devel] " Eric Blake
2016-02-03  5:06   ` David Gibson
2016-02-03  5:06     ` [Qemu-devel] " David Gibson
2016-02-02 16:14 ` [Qemu-devel] [PATCH v6 5/5] doc: Introduce coding style for errors Lluís Vilanova
2016-02-02 19:10   ` Markus Armbruster
2016-02-03 13:47     ` Lluís Vilanova
2016-02-03 14:41       ` Markus Armbruster
2016-02-03 15:17         ` Lluís Vilanova
2016-02-03 15:53           ` Markus Armbruster
2016-02-03 16:58   ` Markus Armbruster

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=20160203050436.GI15080@voom.fritz.box \
    --to=david@gibson.dropbear.id.au \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=thuth@redhat.com \
    --cc=vilanova@ac.upc.edu \
    /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.