summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-10-26 13:50:38 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-11-14 23:19:04 +0900
commite0be348e4d6ebd660c9558bcee50f648491cfef6 (patch)
tree4ea88f1ce00fffe032cd47bdbf0ebc6b98696fd0 /scripts
parent9ed07ada0e1476a676450056a20226b88076025e (diff)
downloadlinux-e0be348e4d6ebd660c9558bcee50f648491cfef6.tar.gz
coccinelle: grep Options and Requires fields more precisely
Currently, the required version for badzero.cocci is picked up from
its "Comments:" line since it contains the word "Requires".

Surprisingly, ld-version.sh can extract the version number from the
string "Requires Coccinelle version 1.0.0-rc20 or later", but this
expectation is fragile.  Fix the .cocci file.  I removed "-rc20"
because ld-version.sh cannot handle it.

Make the coccicheck script to see exact patterns for "Options:" and
"Requires:" in order to avoid accidental matching to what just happens
to appear in comment lines.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Acked-by: Julia Lawall <julia.lawall@lip6.fr>
Acked-by: Nicolas Palix <nicolas.palix@imag.fr>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/coccicheck4
-rw-r--r--scripts/coccinelle/null/badzero.cocci2
2 files changed, 3 insertions, 3 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 864b17e05e63..97f28f0f9498 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -168,8 +168,8 @@ OPTIONS="$OPTIONS $SPFLAGS"
 coccinelle () {
     COCCI="$1"
 
-    OPT=`grep "Option" $COCCI | cut -d':' -f2`
-    REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"`
+    OPT=`grep "Options:" $COCCI | cut -d':' -f2`
+    REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"`
     REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh)
     if [ "$REQ_NUM" != "0" ] ; then
 	    if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then
diff --git a/scripts/coccinelle/null/badzero.cocci b/scripts/coccinelle/null/badzero.cocci
index 5551da2b4fe3..f597c8007b76 100644
--- a/scripts/coccinelle/null/badzero.cocci
+++ b/scripts/coccinelle/null/badzero.cocci
@@ -10,7 +10,7 @@
 // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6.  GPLv2.
 // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6.  GPLv2.
 // URL: http://coccinelle.lip6.fr/
-// Comments: Requires Coccinelle version 1.0.0-rc20 or later
+// Requires: 1.0.0
 // Options:
 
 virtual patch