qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu-devel@nongnu.org, Juan Quintela <quintela@redhat.com>,
	Leonardo Bras <leobras@redhat.com>,
	Lidong Chen <lidongchen@tencent.com>,
	Li Zhijian <lizhijian@cn.fujitsu.com>
Subject: Re: migration/rdma.c's macro ERROR()
Date: Fri, 5 May 2023 10:26:09 -0400	[thread overview]
Message-ID: <ZFUSAXDMHztKGdlO@x1n> (raw)
In-Reply-To: <87sfcbuk3i.fsf@pond.sub.org>

On Fri, May 05, 2023 at 12:51:45PM +0200, Markus Armbruster wrote:
> migration/rdma.c has
> 
>     /*
>      * Print and error on both the Monitor and the Log file.
>      */
>     #define ERROR(errp, fmt, ...) \
>         do { \
>             fprintf(stderr, "RDMA ERROR: " fmt "\n", ## __VA_ARGS__); \
>             if (errp && (*(errp) == NULL)) { \
>                 error_setg(errp, "RDMA ERROR: " fmt, ## __VA_ARGS__); \
>             } \
>         } while (0)
> 
> This is problematic.  The point of error_setg() & friends is detectin
> errors from handling them.  error.h:
> 
>  * - Separation of concerns: the function is responsible for detecting
>  *   errors and failing cleanly; handling the error is its caller's
>  *   job.  [...]
> 
> Reporting the error to stderr violates this principle.  Consequences
> include
> 
> * When the caller reports the error to stderr, it gets reported there
>   twice, possibly in slightly different form.
> 
> * When the caller recovers from the error cleanly without reporting it,
>   it is reported to stderr anyway, even though it is not actually an
>   error.
> 
> Mind if I kill the macro?

Makes sense to me.

/me copies the most recent (in past two years) active developers on rdma so
they're aware.

-- 
Peter Xu



      reply	other threads:[~2023-05-05 14:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-05 10:51 migration/rdma.c's macro ERROR() Markus Armbruster
2023-05-05 14:26 ` Peter Xu [this message]

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=ZFUSAXDMHztKGdlO@x1n \
    --to=peterx@redhat.com \
    --cc=armbru@redhat.com \
    --cc=leobras@redhat.com \
    --cc=lidongchen@tencent.com \
    --cc=lizhijian@cn.fujitsu.com \
    --cc=qemu-devel@nongnu.org \
    --cc=quintela@redhat.com \
    /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).