From: vaishali.thakkar@oracle.com (Vaishali Thakkar)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
Date: Fri, 6 May 2016 10:17:48 +0530 [thread overview]
Message-ID: <572C21F4.9060607@oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1605052209460.2215@localhost6.localdomain6>
On Friday 06 May 2016 01:40 AM, Julia Lawall wrote:
>
>
> On Wed, 27 Apr 2016, Vaishali Thakkar wrote:
>
>> Add a new rule to detect the cases where sizeof is used as a
>> subexpression rather than a top level argument.
>>
>> Also, for the patch mode third rule should behave same as
>> second rule with arguments reversed. So, change that as well.
>>
>> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
>> ---
>> scripts/coccinelle/misc/noderef.cocci | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
>> index 80a831c..9991ee9 100644
>> --- a/scripts/coccinelle/misc/noderef.cocci
>> +++ b/scripts/coccinelle/misc/noderef.cocci
>> @@ -16,6 +16,7 @@ virtual patch
>> @depends on patch@
>> expression *x;
>> expression f;
>> +identifier i;
>
> I think that i could be an expression in both cases?
Yeah, that would be fine I guess. I'll send the v2.
> julia
>
>> type T;
>> @@
>>
>> @@ -30,7 +31,12 @@ f(...,(T)(x),...,sizeof(
>> + *x
>> ),...)
>> |
>> -f(...,sizeof(x),...,(T)(
>> +f(...,sizeof(
>> +- x
>> ++ *x
>> + ),...,(T)(x),...)
>> +|
>> +x = f(...,i*sizeof(
>> - x
>> + *x
>> ),...)
>> @@ -39,6 +45,7 @@ f(...,sizeof(x),...,(T)(
>> @r depends on !patch@
>> expression *x;
>> expression f;
>> +identifier i;
>> position p;
>> type T;
>> @@
>> @@ -49,6 +56,8 @@ type T;
>> *f(...,(T)(x),...,sizeof at p(x),...)
>> |
>> *f(...,sizeof at p(x),...,(T)(x),...)
>> +|
>> +*x = f(...,i*sizeof at p(x),...)
>> )
>>
>> @script:python depends on org@
>> --
>> 2.1.4
>>
>>
--
Vaishali
WARNING: multiple messages have this Message-ID (diff)
From: Vaishali Thakkar <vaishali.thakkar@oracle.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Gilles Muller <Gilles.Muller@lip6.fr>,
nicolas.palix@imag.fr, mmarek@suse.com, cocci@systeme.lip6.fr,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
Date: Fri, 6 May 2016 10:17:48 +0530 [thread overview]
Message-ID: <572C21F4.9060607@oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1605052209460.2215@localhost6.localdomain6>
On Friday 06 May 2016 01:40 AM, Julia Lawall wrote:
>
>
> On Wed, 27 Apr 2016, Vaishali Thakkar wrote:
>
>> Add a new rule to detect the cases where sizeof is used as a
>> subexpression rather than a top level argument.
>>
>> Also, for the patch mode third rule should behave same as
>> second rule with arguments reversed. So, change that as well.
>>
>> Signed-off-by: Vaishali Thakkar <vaishali.thakkar@oracle.com>
>> ---
>> scripts/coccinelle/misc/noderef.cocci | 11 ++++++++++-
>> 1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
>> index 80a831c..9991ee9 100644
>> --- a/scripts/coccinelle/misc/noderef.cocci
>> +++ b/scripts/coccinelle/misc/noderef.cocci
>> @@ -16,6 +16,7 @@ virtual patch
>> @depends on patch@
>> expression *x;
>> expression f;
>> +identifier i;
>
> I think that i could be an expression in both cases?
Yeah, that would be fine I guess. I'll send the v2.
> julia
>
>> type T;
>> @@
>>
>> @@ -30,7 +31,12 @@ f(...,(T)(x),...,sizeof(
>> + *x
>> ),...)
>> |
>> -f(...,sizeof(x),...,(T)(
>> +f(...,sizeof(
>> +- x
>> ++ *x
>> + ),...,(T)(x),...)
>> +|
>> +x = f(...,i*sizeof(
>> - x
>> + *x
>> ),...)
>> @@ -39,6 +45,7 @@ f(...,sizeof(x),...,(T)(
>> @r depends on !patch@
>> expression *x;
>> expression f;
>> +identifier i;
>> position p;
>> type T;
>> @@
>> @@ -49,6 +56,8 @@ type T;
>> *f(...,(T)(x),...,sizeof@p(x),...)
>> |
>> *f(...,sizeof@p(x),...,(T)(x),...)
>> +|
>> +*x = f(...,i*sizeof@p(x),...)
>> )
>>
>> @script:python depends on org@
>> --
>> 2.1.4
>>
>>
--
Vaishali
next prev parent reply other threads:[~2016-05-06 4:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 11:41 [Cocci] [PATCH] Coccinelle: noderef: Add a rule and correct the old rule Vaishali Thakkar
2016-04-27 11:41 ` Vaishali Thakkar
2016-05-05 20:10 ` [Cocci] " Julia Lawall
2016-05-05 20:10 ` Julia Lawall
2016-05-06 4:47 ` Vaishali Thakkar [this message]
2016-05-06 4:47 ` Vaishali Thakkar
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=572C21F4.9060607@oracle.com \
--to=vaishali.thakkar@oracle.com \
--cc=cocci@systeme.lip6.fr \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.