[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 01/29] coccinelle: add a script to enforce qemu/
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 01/29] coccinelle: add a script to enforce qemu/osdep.h macros usage |
Date: |
Tue, 18 Jul 2017 10:18:50 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/18/2017 01:09 AM, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
Might be worth mentioning which macros in the commit message body, so
that a grep of 'git log' spots this commit easier.
> ---
> scripts/coccinelle/use_osdep.cocci | 60
> ++++++++++++++++++++++++++++++++++++++
> 1 file changed, 60 insertions(+)
> create mode 100644 scripts/coccinelle/use_osdep.cocci
>
> +// docker run --rm -v `pwd`:`pwd` -w `pwd` philmd/coccinelle \
> +// --macro-file scripts/cocci-macro-file.h \
> +// --sp-file scripts/coccinelle/add_osdep.cocci \
> +// --keep-comments --in-place \
> +// --use-gitgrep --dir .
Is '--use-gitgrep' a relatively new option to spatch (not present in my
F26 coccinelle-1.0.6-7), or is it a directive specific to the docker
coccinelle package you are using? It's somewhat nice if there is a
clean separation between which arguments are for spatch and which are
for docker.
> +
> +// Use QEMU_IS_ALIGNED()
> +@@
> +typedef uintptr_t;
> +uintptr_t ptr;
> +expression n, m;
> +@@
> +(
> +-ptr % m == 0
> ++QEMU_PTR_IS_ALIGNED(ptr, m)
> +|
> +-n % m == 0
> ++QEMU_IS_ALIGNED(n, m)
> +)
Is it worth also trying to flag '(n & (m - 1)) == 0' (for when m is a
power of 2)?
> +
> +// Use QEMU_ALIGN_DOWN()
> +@@
> +expression n, m;
> +@@
> +-n / m * m
> ++QEMU_ALIGN_DOWN(n, m)
Is it worth also trying to catch (n >> m) << m?
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 00/29] coccinelle script to enforce qemu/osdep.h macros usage, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 02/29] pci: remove superfluous parenthesis, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 01/29] coccinelle: add a script to enforce qemu/osdep.h macros usage, Philippe Mathieu-Daudé, 2017/07/18
- Re: [Qemu-devel] [PATCH 01/29] coccinelle: add a script to enforce qemu/osdep.h macros usage,
Eric Blake <=
- [Qemu-devel] [PATCH 03/29] qemu-img: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 04/29] scsi-disk: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 05/29] block: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 06/29] migration/block: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18
- [Qemu-devel] [PATCH 07/29] ds1338: use QEMU_IS_ALIGNED macro, Philippe Mathieu-Daudé, 2017/07/18