[PATCH v2 1/8] Coccinelle: atomic_as_refcounter: Delete an unnecessary SmPL rule

From: SF Markus Elfring
Date: Mon Jul 16 2018 - 13:24:58 EST


From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 16 Jul 2018 17:15:26 +0200

A search was specified in the rule âr4â for function calls which should be
found by the rule âr1â already in a script for the semantic patch language.
It is useless to repeat a source code search there just to determine
that a variable assignment was performed also for an input parameter
of such a function call (while the same message will be displayed so far).
Thus delete an inappropriate search specification.

Signed-off-by: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
---
.../coccinelle/api/atomic_as_refcounter.cocci | 33 -------------------
1 file changed, 33 deletions(-)

diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index 988120e0fd67..61fcaf5e45a3 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -57,39 +57,6 @@ p2 << r1.p2;
msg = "atomic_dec_and_test variation before object free at line %s."
coccilib.report.print_report(p1[0], msg % (p2[0].line))

-@r4 exists@
-identifier a, x, y;
-position p1, p2;
-identifier fname =~ ".*free.*";
-
-@@
-
-(
- atomic_dec_and_test@p1(&(a)->x)
-|
- atomic_dec_and_lock@p1(&(a)->x, ...)
-|
- atomic_long_dec_and_lock@p1(&(a)->x, ...)
-|
- atomic_long_dec_and_test@p1(&(a)->x)
-|
- atomic64_dec_and_test@p1(&(a)->x)
-|
- local_dec_and_test@p1(&(a)->x)
-)
-...
-y=a
-...
-fname@p2(y, ...);
-
-
-@script:python depends on report@
-p1 << r4.p1;
-p2 << r4.p2;
-@@
-msg = "atomic_dec_and_test variation before object free at line %s."
-coccilib.report.print_report(p1[0], msg % (p2[0].line))
-
@r2 exists@
identifier a, x;
position p1;
--
2.18.0