History

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.

Masahiro Yamada committed 9 years ago

Commit e0be3481 parent 9ed07ad2 files · +3 −3Browse files

Showing the changes to scripts (2 of 2 files). Show all

Unified · Split

2 files
  1. scripts/coccicheck +2 −2
  2. scripts/coccinelle/null/badzero.cocci +1 −1
scripts/coccicheck+2−2
@@ -168,8 +168,8 @@ OPTIONS="$OPTIONS $SPFLAGS" · 167 unmodified lines
168coccinelle () {168coccinelle () {
169 COCCI="$1"169 COCCI="$1"
170 170
171 OPT=`grep "Option" $COCCI | cut -d':' -f2`171 OPT=`grep "Options:" $COCCI | cut -d':' -f2`
172 REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"`172 REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"`
173 REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh)173 REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh)
174 if [ "$REQ_NUM" != "0" ] ; then174 if [ "$REQ_NUM" != "0" ] ; then
175 if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then175 if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then
scripts/coccinelle/null/badzero.cocci+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
10// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.10// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
11// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.11// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
12// URL: http://coccinelle.lip6.fr/12// URL: http://coccinelle.lip6.fr/
13// Comments: Requires Coccinelle version 1.0.0-rc20 or later13// Requires: 1.0.0
14// Options:14// Options:
15 15
16virtual patch16virtual patch