Skip to content

Commit e0be348

Browse files
committed
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>
1 parent 9ed07ad commit e0be348

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎scripts/coccicheck‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,8 @@ OPTIONS="$OPTIONS $SPFLAGS"
168168
coccinelle () {
169169
COCCI="$1"
170170

171-
OPT=`grep "Option" $COCCI | cut -d':' -f2`
172-
REQ=`grep "Requires" $COCCI | cut -d':' -f2 | sed "s| ||"`
171+
OPT=`grep "Options:" $COCCI | cut -d':' -f2`
172+
REQ=`grep "Requires:" $COCCI | cut -d':' -f2 | sed "s| ||"`
173173
REQ_NUM=$(echo $REQ | ${DIR}/scripts/ld-version.sh)
174174
if [ "$REQ_NUM" != "0" ] ; then
175175
if [ "$SPATCH_VERSION_NUM" -lt "$REQ_NUM" ] ; then

‎scripts/coccinelle/null/badzero.cocci‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2.
1111
// Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2.
1212
// URL: http://coccinelle.lip6.fr/
13-
// Comments: Requires Coccinelle version 1.0.0-rc20 or later
13+
// Requires: 1.0.0
1414
// Options:
1515

1616
virtual patch

0 commit comments

Comments
 (0)