[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.10.1608011429090.3188@hadrien>
Date: Mon, 1 Aug 2016 14:32:46 +0200 (CEST)
From: Julia Lawall <julia.lawall@...6.fr>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
cc: Amitoj Kaur Chawla <amitoj1606@...il.com>,
LKML <linux-kernel@...r.kernel.org>,
Coccinelle <cocci@...teme.lip6.fr>,
Gilles Muller <Gilles.Muller@...6.fr>,
Michal Marek <mmarek@...e.com>,
Nicolas Palix <nicolas.palix@...g.fr>
Subject: Re: [Cocci] [PATCH v3] Coccinelle: Script to replace allocate and
memset with zalloc functions
On Mon, 1 Aug 2016, SF Markus Elfring wrote:
> >> How do you think about the following SmPL script example?
> >>
> >> @vz_combined
> >> depends on patch && !context && !org && !report@
> >> type T;
> >> T* pointer;
> >> +statement S;
> >> expression express;
> >> @@
> >> pointer =
> >> - vmalloc
> >> + vzalloc
> >> (...);
> >> if (!d)
> >> S
> >> -memset(d, 0, sizeof(
> >> (
> >> -T
> >> |
> >> -*(express)
> >> )
> >> -));
Actually, this is a mess. pointer, d, and express are all supposed to be
the same thing, as they were in the original rule.
Furthermore, this shows a reason why the original rule was better. If you
say T *pointer, then you require that Coccinelle can find the type
sofficiently to know that it is a pointer. There was no such constraint
in the sizeof(*d) variant of the original rule.
> > The performance issue is that disjunctions on expressions, eg (A | B), are
> > implemented as (A | (!A & B)), ie with a negation of all the previous
> > options &d with each option. So it is better to avoid very large
> > disjunctions on expressions.
>
> Is the suggested SmPL disjunction still small enough for this concern?
2 elements is OK.
julia
Powered by blists - more mailing lists