From: Cornelia Huck <cohuck@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Halil Pasic <pasic@linux.ibm.com>,
qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Peter Xu <peterx@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 2/3] qemu-error: make use of {error, warn}_report_once_cond
Date: Wed, 29 Aug 2018 18:23:19 +0200 [thread overview]
Message-ID: <20180829182319.4dd00611.cohuck@redhat.com> (raw)
In-Reply-To: <877ek9883z.fsf@dusky.pond.sub.org>
On Wed, 29 Aug 2018 18:12:32 +0200
Markus Armbruster <armbru@redhat.com> wrote:
> Cornelia Huck <cohuck@redhat.com> writes:
>
> > {error,warn}_report_once() are a special case of the new functions
> > and can simply switch to them.
> >
> > Signed-off-by: Cornelia Huck <cohuck@redhat.com>
> > ---
> > include/qemu/error-report.h | 10 ++--------
> > 1 file changed, 2 insertions(+), 8 deletions(-)
> >
> > diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h
> > index d2a6515e68..4e4c0e757c 100644
> > --- a/include/qemu/error-report.h
> > +++ b/include/qemu/error-report.h
> > @@ -58,10 +58,7 @@ void warn_report_once_cond(bool *printed, const char *fmt, ...)
> > static bool print_once_; \
> > bool ret_print_once_ = !print_once_; \
> > \
> > - if (!print_once_) { \
> > - print_once_ = true; \
> > - error_report(fmt, ##__VA_ARGS__); \
> > - } \
> > + error_report_once_cond(&print_once_, fmt, ##__VA_ARGS__); \
> > unlikely(ret_print_once_); \
> > })
> >
> > @@ -74,10 +71,7 @@ void warn_report_once_cond(bool *printed, const char *fmt, ...)
> > static bool print_once_; \
> > bool ret_print_once_ = !print_once_; \
> > \
> > - if (!print_once_) { \
> > - print_once_ = true; \
> > - warn_report(fmt, ##__VA_ARGS__); \
> > - } \
> > + warn_report_once_cond(&print_once_, fmt, ##__VA_ARGS__); \
> > unlikely(ret_print_once_); \
> > })
>
> Hmm. The macros return a value, while the functions do not. Doesn't
> this contradict the commit message's claim the macros are ä special case
> of the new functions"?
>
> If you make the functions return the value, too, the macros become
> simpler. Moving complexity from macros to functions feels like a good
> deal, even when it's just a little bit of complexity like here.
Reducing macro complexity is a good idea, agreed.
Thanks for looking!
next prev parent reply other threads:[~2018-08-29 16:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-28 12:33 [Qemu-devel] [PATCH 0/3] qemu-error: advanced report_once handling Cornelia Huck
2018-08-28 12:33 ` [Qemu-devel] [PATCH 1/3] qemu-error: add {error, warn}_report_once_cond Cornelia Huck
2018-08-29 16:07 ` Markus Armbruster
2018-08-29 16:17 ` Cornelia Huck
2018-08-28 12:33 ` [Qemu-devel] [PATCH 2/3] qemu-error: make use of " Cornelia Huck
2018-08-29 16:12 ` Markus Armbruster
2018-08-29 16:23 ` Cornelia Huck [this message]
2018-08-28 12:33 ` [Qemu-devel] [PATCH 3/3] vfio-ccw: switch to warn_report_once_cond() Cornelia Huck
2018-08-29 18:56 ` [Qemu-devel] [PATCH 0/3] qemu-error: advanced report_once handling 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=20180829182319.4dd00611.cohuck@redhat.com \
--to=cohuck@redhat.com \
--cc=armbru@redhat.com \
--cc=pasic@linux.ibm.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@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 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.