aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccicheck
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 19:18:59 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-28 19:18:59 -0400
commite596c79050eafea89cf9fe26b7a807643a2a9904 (patch)
tree36a0c9b0d4cb149c2c5098be2257639631e5d6c6 /scripts/coccicheck
parent51399a391940e676877c7a791138081f13a0bab7 (diff)
parent9231d9e02a1f92b52bbb1e4474bfd1903835a993 (diff)
Merge branch 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'misc' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6: (39 commits) Revert "namespace: add source file location exceptions" Coccinelle: Add contextual message Coccinelle: Fix documentation Coccinelle: Find doubled arguments to boolean or bit operators. Coccinelle: Find nested lock+irqsave functions that use the same flags variables. namespace: add source file location exceptions scripts/extract-ikconfig: add support for bzip2, lzma and lzo kbuild: check return value of asprintf() scripts/namespace.pl: improve to get more correct results scripts/namespace.pl: some bug fixes scripts/namespace.pl: update file exclusion list scripts/namespace.pl: fix wrong source path Coccinelle: Use the -no_show_diff option for org and report mode Coccinelle: Add a new mode named 'chain' Coccinelle: Use new comment format to explain kfree.cocci Coccinelle: Improve user information with a new kind of comment Coccinelle: Update documentation MAINTAINERS: Coccinelle: Update email address Documentation/kbuild: modules.txt cleanup Documentation/kbuild: major edit of modules.txt sections 5-8 ...
Diffstat (limited to 'scripts/coccicheck')
-rwxr-xr-xscripts/coccicheck46
1 files changed, 36 insertions, 10 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index b8bcf1f7bed7..1bb1a1bd2daa 100755
--- a/scripts/coccicheck
+++ b/scripts/coccicheck
@@ -16,6 +16,7 @@ if [ "$C" = "1" -o "$C" = "2" ]; then
16else 16else
17 ONLINE=0 17 ONLINE=0
18 FLAGS="-very_quiet" 18 FLAGS="-very_quiet"
19 OPTIONS="-dir $srctree"
19fi 20fi
20 21
21if [ ! -x "$SPATCH" ]; then 22if [ ! -x "$SPATCH" ]; then
@@ -25,11 +26,13 @@ fi
25 26
26if [ "$MODE" = "" ] ; then 27if [ "$MODE" = "" ] ; then
27 if [ "$ONLINE" = "0" ] ; then 28 if [ "$ONLINE" = "0" ] ; then
28 echo 'You have not explicitly specify the mode to use. Fallback to "report".' 29 echo 'You have not explicitly specified the mode to use. Using default "chain" mode.'
30 echo 'All available modes will be tried (in that order): patch, report, context, org'
29 echo 'You can specify the mode with "make coccicheck MODE=<mode>"' 31 echo 'You can specify the mode with "make coccicheck MODE=<mode>"'
30 echo 'Available modes are: report, patch, context, org'
31 fi 32 fi
32 MODE="report" 33 MODE="chain"
34elif [ "$MODE" = "report" -o "$MODE" = "org" ] ; then
35 FLAGS="$FLAGS -no_show_diff"
33fi 36fi
34 37
35if [ "$ONLINE" = "0" ] ; then 38if [ "$ONLINE" = "0" ] ; then
@@ -44,7 +47,7 @@ coccinelle () {
44 47
45 OPT=`grep "Option" $COCCI | cut -d':' -f2` 48 OPT=`grep "Option" $COCCI | cut -d':' -f2`
46 49
47# The option '-parse_cocci' can be used to syntaxically check the SmPL files. 50# The option '-parse_cocci' can be used to syntactically check the SmPL files.
48# 51#
49# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null 52# $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null
50 53
@@ -52,21 +55,44 @@ coccinelle () {
52 55
53 FILE=`echo $COCCI | sed "s|$srctree/||"` 56 FILE=`echo $COCCI | sed "s|$srctree/||"`
54 57
55 echo "Processing `basename $COCCI` with option(s) \"$OPT\"" 58 echo "Processing `basename $COCCI`"
59 echo "with option(s) \"$OPT\""
60 echo ''
56 echo 'Message example to submit a patch:' 61 echo 'Message example to submit a patch:'
57 62
58 sed -e '/\/\/\//!d' -e 's|^///||' $COCCI 63 sed -ne 's|^///||p' $COCCI
59 64
60 echo ' The semantic patch that makes this change is available' 65 if [ "$MODE" = "patch" ] ; then
66 echo ' The semantic patch that makes this change is available'
67 elif [ "$MODE" = "report" ] ; then
68 echo ' The semantic patch that makes this report is available'
69 elif [ "$MODE" = "context" ] ; then
70 echo ' The semantic patch that spots this code is available'
71 elif [ "$MODE" = "org" ] ; then
72 echo ' The semantic patch that makes this Org report is available'
73 else
74 echo ' The semantic patch that makes this output is available'
75 fi
61 echo " in $FILE." 76 echo " in $FILE."
62 echo '' 77 echo ''
63 echo ' More information about semantic patching is available at' 78 echo ' More information about semantic patching is available at'
64 echo ' http://coccinelle.lip6.fr/' 79 echo ' http://coccinelle.lip6.fr/'
65 echo '' 80 echo ''
66 81
67 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT -dir $srctree || exit 1 82 if [ "`sed -ne 's|^//#||p' $COCCI`" ] ; then
83 echo 'Semantic patch information:'
84 sed -ne 's|^//#||p' $COCCI
85 echo ''
86 fi
87 fi
88
89 if [ "$MODE" = "chain" ] ; then
90 $SPATCH -D patch $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
91 $SPATCH -D report $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || \
92 $SPATCH -D context $FLAGS -sp_file $COCCI $OPT $OPTIONS || \
93 $SPATCH -D org $FLAGS -sp_file $COCCI $OPT $OPTIONS -no_show_diff || exit 1
68 else 94 else
69 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1 95 $SPATCH -D $MODE $FLAGS -sp_file $COCCI $OPT $OPTIONS || exit 1
70 fi 96 fi
71 97
72} 98}