[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] coccinelle: new inplace-byteswaps.cocci to remo
From: |
Richard Henderson |
Subject: |
Re: [Qemu-devel] [PATCH] coccinelle: new inplace-byteswaps.cocci to remove inplace-byteswapping calls |
Date: |
Wed, 10 Oct 2018 07:26:16 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/9/18 11:16 AM, Peter Maydell wrote:
> Add a new Coccinelle script which replaces uses of the inplace
> byteswapping functions *_to_cpus() and cpu_to_*s() with their
> not-in-place equivalents. This is useful for where the swapping
> is done on members of a packed struct -- taking the address
> of the member to pass it to an inplace function is undefined
> behaviour in C.
>
> Signed-off-by: Peter Maydell <address@hidden>
> ---
> Richard asked for a coccinelle script in the scripts/coccinelle
> directory, so here's a patch to add it.
>
> scripts/coccinelle/inplace-byteswaps.cocci | 65 ++++++++++++++++++++++
> 1 file changed, 65 insertions(+)
> create mode 100644 scripts/coccinelle/inplace-byteswaps.cocci
Thanks,
Reviewed-by: Richard Henderson <address@hidden>
r~