Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2)
Subsystems (2)
Nicolas Palix
maintainerPATCH 1/4 Coccinelle: Restore coccicheck verbosity in ONLINE mode (C=1 or C=2)
A recent patch have introduce the VERBOSE variable and comments now depend on it. However, the message printed for each cocci file such not be printed when the ONLINE mode is active, whatever is the value of VERBOSE.
--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/coccicheck +1 -1
@@ -72,7 +72,7 @@ coccinelle () { # # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null - if [ $VERBOSE -ne 0 ] ; then + if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then FILE=`echo $COCCI | sed "s|$srctree/||"`
Signature · 1 line
1.7.10.4
Nicolas Palix
maintainerPATCH 2/4 Coccinelle: Cleanup the setting of the FLAGS and OPTIONS variables
The FLAGS variable is factorized independently of the ONLINE mode. The OPTIONS variable is now based on LINUXINCLUDE and explicit includes are thus removed.
The format of the -I option differs between gcc and spatch. The COCCIINCLUDE is used to adapt the format. This rewritting needs bash.
--- scripts/coccicheck | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
scripts/coccicheck +13 -12
@@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SPATCH="`which ${SPATCH:=spatch}`"
@@ -11,24 +11,25 @@ else VERBOSE=0 fi +FLAGS="-very_quiet" + +# spatch only allows include directories with the syntax "-I include" +# while gcc also allows "-Iinclude" and "-include include" +COCCIINCLUDE=${LINUXINCLUDE//-I/-I } +COCCIINCLUDE=${COCCIINCLUDE//-include/-I} + if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 -# This requires Coccinelle >= 0.2.3 -# FLAGS="-ignore_unknown_options -very_quiet" -# OPTIONS=$* - -# Workaround for Coccinelle < 0.2.3 - FLAGS="-I $srctree/include -very_quiet" - shift $(( $# - 1 )) - OPTIONS=$1 + # Take only the last argument, which is the C file to test + shift $(( $# - 1 )) + OPTIONS="$COCCIINCLUDE $1" else ONLINE=0 - FLAGS="-very_quiet" if [ "$KBUILD_EXTMOD" = "" ] ; then - OPTIONS="-dir $srctree" + OPTIONS="-dir $srctree $COCCIINCLUDE" else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE" fi fi
Signature · 1 line
1.7.10.4
Nicolas Palix
maintainerPATCH 3/4 Coccinelle: Add support to the SPFLAGS variable
In reply to Nicolas PalixThe SPFLAGS variable allows to pass additional options to spatch, e.g. -use_glimpse.
--- Documentation/coccinelle.txt | 11 ++++++++++- scripts/coccicheck | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-)
Documentation/coccinelle.txt +10 -1
@@ -114,7 +114,7 @@ To apply Coccinelle to a specific directory, M= can be used. For example, to check drivers/net/wireless/ one may write: make coccicheck M=drivers/net/wireless/ - + To apply Coccinelle on a file basis, instead of a directory basis, the following command may be used:
@@ -134,6 +134,15 @@ MODE variable explained above. In this mode, there is no information about semantic patches displayed, and no commit message proposed. + Additional flags +~~~~~~~~~~~~~~~~~~ + +Additional flags can be passed to spatch through the SPFLAGS +variable. + + make SPFLAGS=--use_glimpse coccicheck + +See spatch --help to learn more about spatch options. Proposing new semantic patches ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
scripts/coccicheck +1 -1
@@ -11,7 +11,7 @@ else VERBOSE=0 fi -FLAGS="-very_quiet" +FLAGS="$SPFLAGS -very_quiet" # spatch only allows include directories with the syntax "-I include" # while gcc also allows "-Iinclude" and "-include include"
Signature · 1 line
1.7.10.4
Nicolas Palix
maintainerPATCH 4/4 Coccinelle: Fix patch output when coccicheck is used with M= and C=
In reply to Nicolas PalixWhen the M variable is used, the -patch option should be given to spatch. This patch fixes the case where C is used.
--- scripts/coccicheck | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
scripts/coccicheck +5 -1
@@ -29,10 +29,14 @@ else if [ "$KBUILD_EXTMOD" = "" ] ; then OPTIONS="-dir $srctree $COCCIINCLUDE" else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE" + OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE" fi fi +if [ "$KBUILD_EXTMOD" != "" ] ; then + OPTIONS="-patch $srctree $OPTIONS" +fi + if [ ! -x "$SPATCH" ]; then echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' exit 1
Signature · 1 line
1.7.10.4
Quoted 9 lines · Nicolas Palix
A recent patch have introduce the VERBOSE variable and comments now depend on it. However, the message printed for each cocci file such not be printed when the ONLINE mode is active, whatever is the value of VERBOSE.
Signed-off-by Nicolas Palix <[email protected]>--- scripts/coccicheck | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I applied these four to kbuild.git#misc.
Michal