qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: "peter.maydell@linaro.org" <peter.maydell@linaro.org>,
	"peter.crosthwaite@xilinx.com" <peter.crosthwaite@xilinx.com>,
	"Huangweidong (C)" <weidong.huang@huawei.com>,
	"aliguori@amazon.com" <aliguori@amazon.com>,
	"marcel.a@redhat.com" <marcel.a@redhat.com>,
	"qemu-trivial@nongnu.org" <qemu-trivial@nongnu.org>,
	Luonengjun <luonengjun@huawei.com>,
	"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>,
	"Huangpeng (Peter)" <peter.huangpeng@huawei.com>,
	"Gonglei (Arei)" <arei.gonglei@huawei.com>,
	"av1474@comtv.ru" <av1474@comtv.ru>,
	"kraxel@redhat.com" <kraxel@redhat.com>,
	"stefanha@redhat.com" <stefanha@redhat.com>,
	"pbonzini@redhat.com" <pbonzini@redhat.com>,
	"dmitry@daynix.com" <dmitry@daynix.com>,
	"imammedo@redhat.com" <imammedo@redhat.com>,
	"lcapitulino@redhat.com" <lcapitulino@redhat.com>,
	"afaerber@suse.de" <afaerber@suse.de>,
	"dgilbert@redhat.com" <dgilbert@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions
Date: Wed, 6 Aug 2014 08:57:42 +0200	[thread overview]
Message-ID: <20140806065742.GC19566@redhat.com> (raw)
In-Reply-To: <874mxq2lvp.fsf@blackfin.pond.sub.org>

On Wed, Aug 06, 2014 at 08:05:46AM +0200, Markus Armbruster wrote:
> "Gonglei (Arei)" <arei.gonglei@huawei.com> writes:
> 
> > Hi,
> >
> >> >
> >> > $WHATEVER: don't use 'Yoda conditions'
> >> >
> >> > 'Yoda conditions' are not part of idiomatic QEMU coding
> >> > style, so rewrite them in the more usual order.
> >> 
> >> 
> >> OK but why stop at these files? How about this
> >> instead?
> >> 
> > I just search c files by using key words like "NULL ==" etc.
> >
> > I don't think we should change conditional statements like ">" and ">=".
> 
> Eric pointed out it's actually incorrect for NaNs.
> 
> If you want to touch inequalities, separate patch(es) please, because
> they need more thorough review, both for correctness and for style.
> 
> > BTW, just using like "value == NULL" instead of "NULL == value" in all files
> > is not a good idea, which we have discussed in my patch serials v2. So, I posted
> > v3, add change log " imitate nearby code about using '!value' or
> > value == NULL' at
> > every patch " .
> 
> Re "not a good idea": I think rewriting "NULL == value" to "value ==
> NULL" *is* a good idea, but rewriting it to "!value" where that blends
> in with surrounding code is a *better* idea.
> 
> Gonglei's patches do that, Michael's don't, but are more complete.
> Therefore:

Yes but it's unrelated to Yoda: we have x != NULL without Yoda
in a lot of places. So this seems, to me, an unrelated issue.

If people feel this == NULL -> !x is desired, it's better to do it all at
once IMHO, and do x != NULL -> x at the same time.

Easy to run another script to do it on top.

> 
> > So, maybe you can post patches for those files I have missed in the serials, 
> > but not simply instead all by semantic script IMO, thanks!
> 
> Easy: apply Gonglei's patches before you run the script.
> 
> You may have to split patches along subsystem boundaries to get them in.
> Bothersome, as it involves guessing boundaries.  Not a request from me,
> just a warning of possible misfortune :)

It's going in through trivial tree, I don't think split-up is necessary.

  reply	other threads:[~2014-08-06  6:58 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-01  7:46 [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 1/8] CODING_STYLE: Section about conditional statement arei.gonglei
2014-08-01 16:01   ` Eric Blake
2014-08-04  0:55     ` Gonglei (Arei)
2014-08-05 15:48       ` Alex Bennée
2014-08-05 15:53         ` Michael S. Tsirkin
2014-08-06  1:53           ` Gonglei (Arei)
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 2/8] usb: don't use 'Yoda conditions' arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 3/8] audio: " arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 4/8] isa-bus: " arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 5/8] " arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 6/8] spice: " arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 7/8] vl: " arei.gonglei
2014-08-01  7:46 ` [Qemu-devel] [PATCH v3 8/8] vmxnet3: " arei.gonglei
2014-08-05 14:02 ` [Qemu-devel] [PATCH v3 for-2.2 0/8] don't use Yoda conditions Michael S. Tsirkin
2014-08-06  1:47   ` Gonglei (Arei)
2014-08-06  6:05     ` Markus Armbruster
2014-08-06  6:57       ` Michael S. Tsirkin [this message]
2014-08-06  7:55         ` Markus Armbruster
2014-08-06  1:53   ` Eric Blake
2014-08-06  6:53     ` Michael S. Tsirkin

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=20140806065742.GC19566@redhat.com \
    --to=mst@redhat.com \
    --cc=afaerber@suse.de \
    --cc=aliguori@amazon.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=av1474@comtv.ru \
    --cc=dgilbert@redhat.com \
    --cc=dmitry@daynix.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=luonengjun@huawei.com \
    --cc=marcel.a@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=weidong.huang@huawei.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).