From: Peter Xu <peterx@redhat.com>
To: Marcel Apfelbaum <marcel@redhat.com>
Cc: Markus Armbruster <armbru@redhat.com>,
peter.maydell@linaro.org, qemu-devel@nongnu.org,
pbonzini@redhat.com, fam@pxdev.xzpeter.org
Subject: Re: [Qemu-devel] [PATCH 1/2] error-report: provide error_report_exit()
Date: Wed, 17 Aug 2016 16:17:06 +0800 [thread overview]
Message-ID: <20160817081706.GH14217@pxdev.xzpeter.org> (raw)
In-Reply-To: <20160816121708.GD9866@pxdev.xzpeter.org>
On Tue, Aug 16, 2016 at 08:17:08PM +0800, Peter Xu wrote:
> > >
> > > Also, please make it a function, not a macro:
> > >
> > > void error_report_fatal(const char *fmt, ...)
> > > {
> > > va_list ap;
> > >
> > > va_start(ap, fmt);
> > > error_vreport(fmt, ap);
> > > va_end(ap);
> > > exit(1);
> > > }
Marcel (and reviewers),
Now if we are having both error_report_fatal() and
error_report_abort(), we'll write error_report() three times if we all
take them as functions.
How about we still use macro this time but leverage error_setg()
macro as mentioned by Fam, like:
+#define error_report_fatal(...) error_setg(&error_fatal, __VA_ARGS__)
+#define error_report_abort(...) error_setg(&error_abort, __VA_ARGS__)
In this case, we avoided calling exit() directly in the macro, and is
much cleaner than writting error_report() content for three times.
-- peterx
next prev parent reply other threads:[~2016-08-17 8:17 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 7:37 [Qemu-devel] [PATCH 0/2] error-report: introduce error_report_exit() Peter Xu
2016-08-11 7:37 ` [Qemu-devel] [PATCH 1/2] error-report: provide error_report_exit() Peter Xu
2016-08-16 11:05 ` Markus Armbruster
2016-08-16 11:53 ` Fam Zheng
2016-08-16 12:17 ` Peter Xu
2016-08-16 12:19 ` Fam Zheng
2016-08-16 14:00 ` Peter Xu
2016-08-16 14:01 ` Fam Zheng
2016-08-16 14:45 ` Markus Armbruster
2016-08-17 6:47 ` Peter Xu
2016-08-17 7:33 ` Markus Armbruster
2016-08-17 7:38 ` Peter Xu
2016-08-17 8:17 ` Peter Xu [this message]
2016-08-17 9:26 ` Markus Armbruster
2016-08-17 9:32 ` Peter Xu
2016-08-11 7:37 ` [Qemu-devel] [PATCH 2/2] error-report: leveraging error_report_exit() Peter Xu
2016-08-11 7:55 ` [Qemu-devel] [PATCH v2] " Peter Xu
2016-08-11 8:01 ` no-reply
2016-08-11 8:47 ` Peter Xu
2016-08-11 8:45 ` Fam Zheng
2016-08-11 8:58 ` Peter Xu
2016-08-11 7:50 ` [Qemu-devel] [PATCH 0/2] error-report: introduce error_report_exit() no-reply
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=20160817081706.GH14217@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=armbru@redhat.com \
--cc=fam@pxdev.xzpeter.org \
--cc=marcel@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).