From: Greg Kurz <gkurz@linux.vnet.ibm.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] vhost_net: fix misuse of assert()
Date: Fri, 19 Jun 2015 16:37:31 +0200 [thread overview]
Message-ID: <20150619163731.5610c28c@bahia.local> (raw)
In-Reply-To: <20150619160502-mutt-send-email-mst@redhat.com>
On Fri, 19 Jun 2015 16:06:04 +0200
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Fri, Jun 19, 2015 at 04:00:05PM +0200, Markus Armbruster wrote:
> > "Michael S. Tsirkin" <mst@redhat.com> writes:
> >
> > > On Fri, Jun 19, 2015 at 12:55:57PM +0200, Markus Armbruster wrote:
> > >> "Michael S. Tsirkin" <mst@redhat.com> writes:
> > >>
> > >> > On Fri, Jun 19, 2015 at 11:13:40AM +0100, Peter Maydell wrote:
> > >> >> On 19 June 2015 at 11:07, Michael S. Tsirkin <mst@redhat.com> wrote:
> > >> >> > On Fri, Jun 19, 2015 at 12:00:53PM +0200, Greg Kurz wrote:
> > >> >> >> In case NDEBUG is defined, assert() expands to nothing and
> > >> >> >> vhost_net_set_vnet_endian() doesn't get called...
> > >> >> >>
> > >> >> >> Suggested-by: Thomas Huth <thuth@redhat.com>
> > >> >> >> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > >> >> >
> > >> >> > Not sure what the point is.
> > >> >> > We don't support building with NDEBUG.
> > >> >>
> > >> >> Putting functional behaviour inside an assert() is still a really
> > >> >> bad idea. If you're reading the code you probably skim over the
> > >> >> assert() as not functionally relevant...
> > >> >>
> > >> >> -- PMM
> > >> >
> > >> > I can apply this if commit log explains it's a readability
> > >> > enhancement, not a bugfix.
> > >>
> > >> Easy:
> > >>
> > >> vhost_net: fix misuse of assert()
> > >>
> > >> In case NDEBUG is defined, assert() expands to nothing and
> > >> vhost_net_set_vnet_endian() doesn't get called...
> > >>
> > >> Suggested-by: Thomas Huth <thuth@redhat.com>
> > >> Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
> > >>
> > >> We don't support building with NDEBUG, but putting functional behaviour
> > >> inside an assert() is still a really bad idea. If you're reading the
> > >> code you probably skim over the assert() as not functionally relevant...
> > >>
> > >> Signed-off-by: Michael S. Tsirkin" <mst@redhat.com>
> > >
> > > Pls submit v2 in the regular format - I can rewrite the commit log
> > > but prefer not to, as it doesn't scale. There's no need to add my
> > > signature though, git am -s does this automatically.
> >
> > I *hate* it when maintainers rewrite my commit message, then claim it's
> > mine :)
> >
> > But that's not what I suggested! I suggested to append the additional
> > explanation you want after Greg's S-o-B. Makes it obvious that it's
> > yours.
>
> Well both the subject and the original commit log are irrelevant IMO:
> why mention NDEBUG when we don't support it? So it's not really
> a misuse.
>
Hmmm... I got obviously un-Cc'd from this thread at some point... but
anyway I've sent a v2 with a more comprehensive log. The subject stays
the same though: putting relevant code in assert() is wrong, even from
a code reading POV.
> > I think that scales just fine in a simple case like this where you
> > already know the explanation.
>
prev parent reply other threads:[~2015-06-19 14:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 10:00 [Qemu-devel] [PATCH] vhost_net: fix misuse of assert() Greg Kurz
2015-06-19 10:07 ` Michael S. Tsirkin
2015-06-19 10:13 ` Peter Maydell
2015-06-19 10:15 ` Michael S. Tsirkin
2015-06-19 10:55 ` Markus Armbruster
2015-06-19 13:37 ` Michael S. Tsirkin
2015-06-19 14:00 ` Markus Armbruster
2015-06-19 14:06 ` Michael S. Tsirkin
2015-06-19 14:37 ` Greg Kurz [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=20150619163731.5610c28c@bahia.local \
--to=gkurz@linux.vnet.ibm.com \
--cc=armbru@redhat.com \
--cc=mst@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).