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 6/6] Coccinelle: atomic_as_refcounter: Use format strings directly in SmPL rules
From
Date
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 2 Jul 2018 19:46:45 +0200

Format strings were always assigned to the Python variable “msg”
before they were used in four rules of a script for the semantic
patch language.
Delete these extra variables so that the specified string objects
are directly used for the desired data output.

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

diff --git a/scripts/coccinelle/api/atomic_as_refcounter.cocci b/scripts/coccinelle/api/atomic_as_refcounter.cocci
index 63cbe866c99f..1e2278ff3261 100644
--- a/scripts/coccinelle/api/atomic_as_refcounter.cocci
+++ b/scripts/coccinelle/api/atomic_as_refcounter.cocci
@@ -40,8 +40,9 @@ identifier fname2 =~ "(?:call_rcu|de(?:l|stroy)|(?:queue|schedule)_work)";
p1 << r1.p1;
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))
+coccilib.report.print_report(p1[0],
+ "atomic_dec_and_test variation before object free at line %s."
+ % (p2[0].line))

@r4 exists@
expression a;
@@ -71,8 +72,9 @@ fname@p2(y, ...);
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))
+coccilib.report.print_report(p1[0],
+ "atomic_dec_and_test variation before object free at line %s."
+ % (p2[0].line))

@r2 exists@
expression a;
@@ -85,8 +87,7 @@ position p1;
@script:python depends on report@
p1 << r2.p1;
@@
-msg = "atomic_add_unless"
-coccilib.report.print_report(p1[0], msg)
+coccilib.report.print_report(p1[0], "atomic_add_unless")

@r3 exists@
expression E;
@@ -99,5 +100,4 @@ position p1;
@script:python depends on report@
p1 << r3.p1;
@@
-msg = "x = atomic_add_return(-1, ...)"
-coccilib.report.print_report(p1[0], msg)
+coccilib.report.print_report(p1[0], "x = atomic_add_return(-1, ...)")
--
2.18.0
\
 
 \ /
  Last update: 2018-07-03 09:49    [W:0.235 / U:4.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site