* [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
@ 2016-04-27 11:41 Vaishali Thakkar
2016-05-05 20:10 ` Julia Lawall
0 siblings, 1 reply; 3+ messages in thread
From: Vaishali Thakkar @ 2016-04-27 11:41 UTC (permalink / raw)
To: Julia.Lawall
Cc: Gilles.Muller, nicolas.palix, mmarek, cocci, linux-kernel,
Vaishali Thakkar
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;
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
2016-04-27 11:41 [PATCH] Coccinelle: noderef: Add a rule and correct the old rule Vaishali Thakkar
@ 2016-05-05 20:10 ` Julia Lawall
2016-05-06 4:47 ` Vaishali Thakkar
0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2016-05-05 20:10 UTC (permalink / raw)
To: Vaishali Thakkar
Cc: Gilles Muller, nicolas.palix, mmarek, cocci, linux-kernel
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?
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
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Coccinelle: noderef: Add a rule and correct the old rule
2016-05-05 20:10 ` Julia Lawall
@ 2016-05-06 4:47 ` Vaishali Thakkar
0 siblings, 0 replies; 3+ messages in thread
From: Vaishali Thakkar @ 2016-05-06 4:47 UTC (permalink / raw)
To: Julia Lawall; +Cc: Gilles Muller, nicolas.palix, mmarek, cocci, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-06 4:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-27 11:41 [PATCH] Coccinelle: noderef: Add a rule and correct the old rule Vaishali Thakkar
2016-05-05 20:10 ` Julia Lawall
2016-05-06 4:47 ` Vaishali Thakkar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).