From: Markus Armbruster <armbru@redhat.com>
To: Thomas Huth <thuth@redhat.com>
Cc: "Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-devel@nongnu.org, fam@euphon.net, kwolf@redhat.com,
hreitz@redhat.com, groug@kaod.org, qemu_oss@crudebyte.com,
Alistair.Francis@wdc.com, bin.meng@windriver.com,
palmer@dabbelt.com, marcandre.lureau@redhat.com,
pbonzini@redhat.com, yuval.shaia.ml@gmail.com,
marcel.apfelbaum@gmail.com, mst@redhat.com, quintela@redhat.com,
dgilbert@redhat.com, pavel.dovgaluk@ispras.ru,
alex.bennee@linaro.org, peterx@redhat.com, david@redhat.com,
mrolnik@gmail.com, gaosong@loongson.cn, yangxiaojuan@loongson.cn,
aurelien@aurel32.net, jiaxun.yang@flygoat.com,
aleksandar.rikalo@syrmia.com, jcmvbkbc@gmail.com,
berrange@redhat.com, lvivier@redhat.com,
suhang16@mails.ucas.ac.cn, chen.zhang@intel.com,
lizhijian@fujitsu.com, stefanha@redhat.com,
qemu-block@nongnu.org, qemu-riscv@nongnu.org,
qemu-ppc@nongnu.org, virtio-fs@redhat.com
Subject: Re: [Virtio-fs] [PATCH] cleanup: Tweak and re-run return_directly.cocci
Date: Tue, 22 Nov 2022 09:58:39 +0100 [thread overview]
Message-ID: <87h6yrfjr4.fsf@pond.sub.org> (raw)
In-Reply-To: <47e0d3d8-607d-5e29-6780-c0a4364993a9@redhat.com> (Thomas Huth's message of "Mon, 21 Nov 2022 17:34:15 +0100")
Thomas Huth <thuth@redhat.com> writes:
> On 21/11/2022 17.32, Markus Armbruster wrote:
>> Philippe Mathieu-Daudé <philmd@linaro.org> writes:
>>
>>> On 21/11/22 15:36, Peter Maydell wrote:
>>>> On Mon, 21 Nov 2022 at 14:03, Markus Armbruster <armbru@redhat.com> wrote:
>>>>>
>>>>> Tweak the semantic patch to drop redundant parenthesis around the
>>>>> return expression.
>>>>>
>>>>> Coccinelle drops comments in hw/rdma/vmw/pvrdma_cmd.c; restored
>>>>> manually.
>>>>>
>>>>> Coccinelle messes up vmdk_co_create(), not sure why. Transformed
>>>>> manually.
>>>>>
>>>>> Line breaks in target/avr/cpu.h and hw/rdma/vmw/pvrdma_cmd.c tidied up
>>>>> manually.
>>>>>
>>>>> Whitespace in fuse_reply_iov() tidied up manually.
>>>>>
>>>>> checkpatch.pl complains "return of an errno should typically be -ve"
>>>>> two times for hw/9pfs/9p-synth.c. Preexisting, the patch merely makes
>>>>> it visible to checkpatch.pl.
>>>>>
>>>>> checkpatch.pl complains "return is not a function, parentheses are not
>>>>> required" three times for target/mips/tcg/dsp_helper.c. False
>>>>> positives.
>>>>>
>>>>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>>>>
>>>>> .../user/ase/msa/bit-count/test_msa_nloc_b.c | 9 +-
>>>>> .../user/ase/msa/bit-count/test_msa_nloc_d.c | 9 +-
>>>> [snip long list of other mips test files]
>>>>
>>>>> 328 files changed, 989 insertions(+), 2099 deletions(-)
>>>> This patch seems to almost entirely be huge because of these
>>>> mips test case files. Are they specific to QEMU or are they
>>>> effectively a 3rd-party import that it doesn't make sense
>>>> to make local changes to?
>>>
>>> They are imported and will unlikely be modified.
>>
>> Not obvious to me from git-log.
>>
>> Should I drop the changes to tests/tcg/mips/?
>
> I'd say yes. At least move them to a separate patch.
Possible status of tests/tcg/mips/:
1. Imported, should not be modified
Drop from the patch.
2. Not imported, should be modified
2a. To be reviewed separately from the remainder of the patch
Split off.
2b. Likewise, but nobody will care to review, realistically
Split off and merge anyway, or drop. I'd go for the latter.
2c. To be reviewed together with the remainder of the patch
Keep as is.
Which one is it?
> Otherwise reviewing
> this patch here is no fun at all.
I don't think complete detailed review is necessary or even sensible.
Review should start with the Coccinelle script:
// replace 'R = X; return R;' with 'return X;'
@@
identifier VAR;
expression E;
type T;
identifier F;
@@
T F(...)
{
...
- T VAR;
... when != VAR
- VAR = (E);
- return VAR;
+ return E;
... when != VAR
}
What could go wrong? Not a rhetorical question!
The simple part is executing the rule. It'll *delete* variable VAR, and
*preserve* expression E.
The tricky part is deciding whether the rule matches, in particular
proving that there are no other uses of VAR. If Coccinelle gets that
wrong, the code no longer compiles *unless* there is another, global VAR
of suitable type.
Turns out Coccinelle does get it wrong for vmdk_co_create(), and the
compiler duly rejects it. I don't understand why it gets it wrong.
To help understand the script, and as a sanity check, reviewing some of
its patches is advisable. Reviewing all of them feels impractical.
next prev parent reply other threads:[~2022-11-22 8:58 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-21 14:01 [Virtio-fs] [PATCH] cleanup: Tweak and re-run return_directly.cocci Markus Armbruster
2022-11-21 14:36 ` Peter Maydell
2022-11-21 15:57 ` Markus Armbruster
2022-11-21 16:03 ` Philippe Mathieu-Daudé
2022-11-21 16:32 ` Markus Armbruster
2022-11-21 16:34 ` Thomas Huth
2022-11-22 8:58 ` Markus Armbruster [this message]
2022-11-22 12:44 ` Peter Maydell
2022-11-22 13:26 ` Markus Armbruster
2022-11-22 13:45 ` Peter Maydell
2022-11-22 14:51 ` Philippe Mathieu-Daudé
2022-11-21 16:42 ` Max Filippov
2022-11-21 17:00 ` Markus Armbruster
2022-11-22 15:03 ` Philippe Mathieu-Daudé
2022-11-22 15:12 ` Peter Maydell
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=87h6yrfjr4.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=Alistair.Francis@wdc.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=berrange@redhat.com \
--cc=bin.meng@windriver.com \
--cc=chen.zhang@intel.com \
--cc=david@redhat.com \
--cc=dgilbert@redhat.com \
--cc=fam@euphon.net \
--cc=gaosong@loongson.cn \
--cc=groug@kaod.org \
--cc=hreitz@redhat.com \
--cc=jcmvbkbc@gmail.com \
--cc=jiaxun.yang@flygoat.com \
--cc=kwolf@redhat.com \
--cc=lizhijian@fujitsu.com \
--cc=lvivier@redhat.com \
--cc=marcandre.lureau@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mrolnik@gmail.com \
--cc=mst@redhat.com \
--cc=palmer@dabbelt.com \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=peterx@redhat.com \
--cc=philmd@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=qemu_oss@crudebyte.com \
--cc=quintela@redhat.com \
--cc=stefanha@redhat.com \
--cc=suhang16@mails.ucas.ac.cn \
--cc=thuth@redhat.com \
--cc=virtio-fs@redhat.com \
--cc=yangxiaojuan@loongson.cn \
--cc=yuval.shaia.ml@gmail.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