Skip to content

Commit

Permalink
coccinelle: grep Options and Requires fields more precisely
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Julia Lawall <[email protected]>
Acked-by: Nicolas Palix <[email protected]>
  • Loading branch information
masahir0y committed Nov 14, 2017
1 parent 9ed07ad commit e0be348
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions scripts/coccicheck
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/coccinelle/null/badzero.cocci
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e0be348

Please sign in to comment.