aboutsummaryrefslogtreecommitdiff
path: root/scripts/coccicheck
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 12:27:18 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 12:27:18 -0800
commitad60a9333035f2323840b71ab8ad07bbab728faf (patch)
treec0bee7557b62a0c1c26ede9cb26f1a1785cfd04c /scripts/coccicheck
parent0ca7ffb356063c5ece847687da457dfe748612a2 (diff)
parent24f0c2d6ff859fbca45fd765f0d241528bdb4365 (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull misc non-critical kbuild changes from Michal Marek: - Fix for make TAGS - Fix for make rpm - Some new coccinelle semantic patches * 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: scripts/coccinelle: find constant additions that could be bit ors coccicheck: Allow to show the executed command line coccicheck: Allow the user to give a V= (verbose) argument scripts/coccinelle/misc/memcpy-assign.cocci: Replace memcpy with struct assignment kbuild: clear KBUILD_SRC when calling 'make' in RPM spec scripts/coccinelle/misc/semicolon.cocci: Add unneeded semicolon test scripts/tags.sh: Fix regex syntax for etags
Diffstat (limited to 'scripts/coccicheck')
-rwxr-xr-xscripts/coccicheck39
1 files changed, 31 insertions, 8 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 1a49d1c7ecf..85d31899ad9 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -2,6 +2,15 @@
SPATCH="`which ${SPATCH:=spatch}`"
+# The verbosity may be set by the environmental parameter V=
+# as for example with 'make V=1 coccicheck'
+
+if [ -n "$V" -a "$V" != "0" ]; then
+ VERBOSE=1
+else
+ VERBOSE=0
+fi
+
if [ "$C" = "1" -o "$C" = "2" ]; then
ONLINE=1
@@ -46,6 +55,14 @@ if [ "$ONLINE" = "0" ] ; then
echo ''
fi
+run_cmd() {
+ if [ $VERBOSE -ne 0 ] ; then
+ echo "Running: $@"
+ fi
+ eval $@
+}
+
+
coccinelle () {
COCCI="$1"
@@ -55,7 +72,7 @@ coccinelle () {
#
# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
- if [ "$ONLINE" = "0" ] ; then
+ if [ $VERBOSE -ne 0 ] ; then
FILE=`echo $COCCI | sed "s|$srctree/||"`
@@ -91,15 +108,21 @@ coccinelle () {
fi
if [ "$MODE" = "chain" ] ; then
- $SPATCH -D patch $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
- $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
- $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
- $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
+ run_cmd $SPATCH -D patch \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
+ run_cmd $SPATCH -D report \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
+ run_cmd $SPATCH -D context \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
+ run_cmd $SPATCH -D org \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
elif [ "$MODE" = "rep+ctxt" ] ; then
- $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
- $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
+ run_cmd $SPATCH -D report \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff && \
+ run_cmd $SPATCH -D context \
+ $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
else
- $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
+ run_cmd $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
fi
}