* [PATCH v2] scripts/coccinelle: sizeof of pointer
@ 2012-04-21 18:23 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2012-04-21 18:23 UTC (permalink / raw)
To: cocci, mmarek, linux-kernel; +Cc: kernel-janitors
From: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
v2, with a better subject
scripts/coccinelle/misc/noderef.cocci | 65 ++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
new file mode 100644
index 0000000..c170721
--- /dev/null
+++ b/scripts/coccinelle/misc/noderef.cocci
@@ -0,0 +1,65 @@
+/// sizeof when applied to a pointer typed expression gives the size of
+/// the pointer
+///
+// Confidence: High
+// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
+// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Comments:
+// Options: -no_includes -include_headers
+
+virtual org
+virtual report
+virtual context
+virtual patch
+
+@depends on patch@
+expression *x;
+expression f;
+type T;
+@@
+
+(
+x = <+... sizeof(
+- x
++ *x
+ ) ...+>
+|
+f(...,(T)(x),...,sizeof(
+- x
++ *x
+ ),...)
+|
+f(...,sizeof(x),...,(T)(
+- x
++ *x
+ ),...)
+)
+
+@r depends on !patch@
+expression *x;
+expression f;
+position p;
+type T;
+@@
+
+(
+*x = <+... sizeof@p(x) ...+>
+|
+*f(...,(T)(x),...,sizeof@p(x),...)
+|
+*f(...,sizeof@p(x),...,(T)(x),...)
+)
+
+@script:python depends on org@
+p << r.p;
+@@
+
+cocci.print_main("application of sizeof to pointer",p)
+
+@script:python depends on report@
+p << r.p;
+@@
+
+msg = "ERROR: application of sizeof to pointer"
+coccilib.report.print_report(p[0],msg)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2] scripts/coccinelle: sizeof of pointer
@ 2012-04-21 18:23 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2012-04-21 18:23 UTC (permalink / raw)
To: cocci, mmarek, linux-kernel; +Cc: kernel-janitors
From: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
v2, with a better subject
scripts/coccinelle/misc/noderef.cocci | 65 ++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)
diff --git a/scripts/coccinelle/misc/noderef.cocci b/scripts/coccinelle/misc/noderef.cocci
new file mode 100644
index 0000000..c170721
--- /dev/null
+++ b/scripts/coccinelle/misc/noderef.cocci
@@ -0,0 +1,65 @@
+/// sizeof when applied to a pointer typed expression gives the size of
+/// the pointer
+///
+// Confidence: High
+// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
+// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
+// URL: http://coccinelle.lip6.fr/
+// Comments:
+// Options: -no_includes -include_headers
+
+virtual org
+virtual report
+virtual context
+virtual patch
+
+@depends on patch@
+expression *x;
+expression f;
+type T;
+@@
+
+(
+x = <+... sizeof(
+- x
++ *x
+ ) ...+>
+|
+f(...,(T)(x),...,sizeof(
+- x
++ *x
+ ),...)
+|
+f(...,sizeof(x),...,(T)(
+- x
++ *x
+ ),...)
+)
+
+@r depends on !patch@
+expression *x;
+expression f;
+position p;
+type T;
+@@
+
+(
+*x = <+... sizeof@p(x) ...+>
+|
+*f(...,(T)(x),...,sizeof@p(x),...)
+|
+*f(...,sizeof@p(x),...,(T)(x),...)
+)
+
+@script:python depends on org@
+p << r.p;
+@@
+
+cocci.print_main("application of sizeof to pointer",p)
+
+@script:python depends on report@
+p << r.p;
+@@
+
+msg = "ERROR: application of sizeof to pointer"
+coccilib.report.print_report(p[0],msg)
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scripts/coccinelle: sizeof of pointer
2012-04-21 18:23 ` Julia Lawall
@ 2012-05-25 12:53 ` Michal Marek
-1 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2012-05-25 12:53 UTC (permalink / raw)
To: Julia Lawall; +Cc: cocci, linux-kernel, kernel-janitors
On Sat, Apr 21, 2012 at 08:23:48PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> v2, with a better subject
>
> scripts/coccinelle/misc/noderef.cocci | 65 ++++++++++++++++++++++++++++++++++
Applied to kbuild.git#misc, thanks.
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] scripts/coccinelle: sizeof of pointer
@ 2012-05-25 12:53 ` Michal Marek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Marek @ 2012-05-25 12:53 UTC (permalink / raw)
To: Julia Lawall; +Cc: cocci, linux-kernel, kernel-janitors
On Sat, Apr 21, 2012 at 08:23:48PM +0200, Julia Lawall wrote:
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
>
> ---
> v2, with a better subject
>
> scripts/coccinelle/misc/noderef.cocci | 65 ++++++++++++++++++++++++++++++++++
Applied to kbuild.git#misc, thanks.
Michal
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-05-25 12:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-21 18:23 [PATCH v2] scripts/coccinelle: sizeof of pointer Julia Lawall
2012-04-21 18:23 ` Julia Lawall
2012-05-25 12:53 ` Michal Marek
2012-05-25 12:53 ` Michal Marek
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.