[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <212e0bf3-0807-e2f1-a6fc-23f9e03906b2@linux.com>
Date: Wed, 24 Mar 2021 10:43:03 +0300
From: Denis Efremov <efremov@...ux.com>
To: Julia Lawall <julia.lawall@...ia.fr>
Cc: cocci@...teme.lip6.fr, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] coccinelle: misc: restrict patch mode in
flexible_array.cocci
Ping?
On 3/8/21 10:12 PM, Denis Efremov wrote:
> Skip patches generation for structs/unions with a single field.
> Changing a zero-length array to a flexible array member in a struct
> with no named members breaks the compilation. However, reporting
> such cases is still valuable, e.g. commit 637464c59e0b
> ("ACPI: NFIT: Fix flexible_array.cocci warnings").
>
> Signed-off-by: Denis Efremov <efremov@...ux.com>
> ---
> scripts/coccinelle/misc/flexible_array.cocci | 23 ++++++++++++++++++--
> 1 file changed, 21 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/coccinelle/misc/flexible_array.cocci b/scripts/coccinelle/misc/flexible_array.cocci
> index 947fbaff82a9..f427fd68ed2d 100644
> --- a/scripts/coccinelle/misc/flexible_array.cocci
> +++ b/scripts/coccinelle/misc/flexible_array.cocci
> @@ -51,21 +51,40 @@ position p : script:python() { relevant(p) };
> };
> )
>
> +@...y_field depends on patch@
> +identifier name, array;
> +type T;
> +position q;
> +@@
> +
> +(
> + struct name {@q
> + T array[0];
> + };
> +|
> + struct {@q
> + T array[0];
> + };
> +)
> +
> @depends on patch@
> identifier name, array;
> type T;
> position p : script:python() { relevant(p) };
> +// position @q with rule "only_field" simplifies
> +// handling of bitfields, arrays, etc.
> +position q != only_field.q;
> @@
>
> (
> - struct name {
> + struct name {@q
> ...
> T array@p[
> - 0
> ];
> };
> |
> - struct {
> + struct {@q
> ...
> T array@p[
> - 0
>
Powered by blists - more mailing lists