summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJulia Lawall <Julia.Lawall@inria.fr>2026-09-27 11:16:22 +0200
committerJulia Lawall <Julia.Lawall@inria.fr>2026-11-01 23:43:36 +0100
commit14be5faa8be7cebb559c91a41d48545c0b1faa16 (patch)
treebc1ae7a36bf1b0a6c38edd56be1859a3fa6bdd94 /scripts
parent6b828a87a63a29bc6b4a597e3a920e2b19c8274e (diff)
scripts/coccinelle: improve efficiency of array_end.cocci
* Add disable zero_multiple_format to each rule to avoid considering the possibility that an array index is expressed using '\0' * Omit outer parentheses on context and org/report rules that only match ubt don't transform, since matching a subterm gives the same result whether or not the parentheses are present. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/coccinelle/misc/array_end.cocci22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/coccinelle/misc/array_end.cocci b/scripts/coccinelle/misc/array_end.cocci
index 88c664de974a..2f0bbc4ce17d 100644
--- a/scripts/coccinelle/misc/array_end.cocci
+++ b/scripts/coccinelle/misc/array_end.cocci
@@ -10,22 +10,22 @@ virtual context
virtual org
virtual report
-@depends on context@
+@depends on context disable zero_multiple_format@
type T;
T[] a;
expression b;
@@
(
-* (a + ARRAY_SIZE(a))
+* a + ARRAY_SIZE(a)
|
-* (&a[0] + ARRAY_SIZE(a))
+* &a[0] + ARRAY_SIZE(a)
|
-* (&a[ARRAY_SIZE(a)])
+* &a[ARRAY_SIZE(a)]
|
-* (&a[ARRAY_SIZE(a) - b])
+* &a[ARRAY_SIZE(a) - b]
)
-@depends on patch@
+@depends on patch disable zero_multiple_format@
type T;
T[] a;
expression b;
@@ -44,20 +44,20 @@ expression b;
+ ARRAY_END(a) - b
)
-@r depends on org || report@
+@r depends on org || report disable zero_multiple_format@
type T;
T[] a;
expression b;
position p;
@@
(
- (a@p + ARRAY_SIZE(a))
+ a@p + ARRAY_SIZE(a)
|
- (&a[0]@p + ARRAY_SIZE(a))
+ &a[0]@p + ARRAY_SIZE(a)
|
- (&a[ARRAY_SIZE(a)]@p)
+ &a[ARRAY_SIZE(a)]@p
|
- (&a[ARRAY_SIZE(a)@p - b])
+ &a[ARRAY_SIZE(a)@p - b]
)
@script:python depends on org@