lkml.org 
[lkml]   [2018]   [Jul]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 5/6] Coccinelle: atomic_as_refcounter: Use nested disjunctions in two SmPL rules
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 2 Jul 2018 19:21:28 +0200

Six function names were specified for a search of function calls
by the means of a disjunction in two rules of a script for
the semantic patch language.
Refactor them into two groups so that the SmPL code repetition
could be reduced a bit.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
.../coccinelle/api/atomic_as_refcounter.cocci | 36 +++++++++----------
1 file changed, 16 insertions(+), 20 deletions(-)

diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index 372ae99591fd..63cbe866c99f 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -18,17 +18,15 @@ identifier fname2 =~ "(?:call_rcu|de(?:l|stroy)|(?:queue|schedule)_work)";
@@

(
- atomic_dec_and_test@p1(&(a)->x)
+(atomic_dec_and_test@p1
+|atomic_long_dec_and_test@p1
+|atomic64_dec_and_test@p1
+|local_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)
+(atomic_dec_and_lock@p1
+|atomic_long_dec_and_lock@p1
+) (&(a)->x, ...)
)
...
(
@@ -53,17 +51,15 @@ 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)
+(atomic_dec_and_test@p1
+|atomic_long_dec_and_test@p1
+|atomic64_dec_and_test@p1
+|local_dec_and_test@p1
+) (&(a)->x)
|
- local_dec_and_test@p1(&(a)->x)
+(atomic_dec_and_lock@p1
+|atomic_long_dec_and_lock@p1
+) (&(a)->x, ...)
)
...
y=a
--
2.18.0
\
 
 \ /
  Last update: 2018-07-03 09:46    [W:0.269 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site