diff options
Diffstat (limited to 'scripts/coccicheck')
-rwxr-xr-x | scripts/coccicheck | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck index 85d31899ad98..06fcb3333247 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck | |||
@@ -1,4 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/bash |
2 | 2 | ||
3 | SPATCH="`which ${SPATCH:=spatch}`" | 3 | SPATCH="`which ${SPATCH:=spatch}`" |
4 | 4 | ||
@@ -11,27 +11,32 @@ else | |||
11 | VERBOSE=0 | 11 | VERBOSE=0 |
12 | fi | 12 | fi |
13 | 13 | ||
14 | FLAGS="$SPFLAGS -very_quiet" | ||
15 | |||
16 | # spatch only allows include directories with the syntax "-I include" | ||
17 | # while gcc also allows "-Iinclude" and "-include include" | ||
18 | COCCIINCLUDE=${LINUXINCLUDE//-I/-I } | ||
19 | COCCIINCLUDE=${COCCIINCLUDE//-include/-I} | ||
20 | |||
14 | if [ "$C" = "1" -o "$C" = "2" ]; then | 21 | if [ "$C" = "1" -o "$C" = "2" ]; then |
15 | ONLINE=1 | 22 | ONLINE=1 |
16 | 23 | ||
17 | # This requires Coccinelle >= 0.2.3 | 24 | # Take only the last argument, which is the C file to test |
18 | # FLAGS="-ignore_unknown_options -very_quiet" | 25 | shift $(( $# - 1 )) |
19 | # OPTIONS=$* | 26 | OPTIONS="$COCCIINCLUDE $1" |
20 | |||
21 | # Workaround for Coccinelle < 0.2.3 | ||
22 | FLAGS="-I $srctree/include -very_quiet" | ||
23 | shift $(( $# - 1 )) | ||
24 | OPTIONS=$1 | ||
25 | else | 27 | else |
26 | ONLINE=0 | 28 | ONLINE=0 |
27 | FLAGS="-very_quiet" | ||
28 | if [ "$KBUILD_EXTMOD" = "" ] ; then | 29 | if [ "$KBUILD_EXTMOD" = "" ] ; then |
29 | OPTIONS="-dir $srctree" | 30 | OPTIONS="-dir $srctree $COCCIINCLUDE" |
30 | else | 31 | else |
31 | OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" | 32 | OPTIONS="-dir $KBUILD_EXTMOD $COCCIINCLUDE" |
32 | fi | 33 | fi |
33 | fi | 34 | fi |
34 | 35 | ||
36 | if [ "$KBUILD_EXTMOD" != "" ] ; then | ||
37 | OPTIONS="-patch $srctree $OPTIONS" | ||
38 | fi | ||
39 | |||
35 | if [ ! -x "$SPATCH" ]; then | 40 | if [ ! -x "$SPATCH" ]; then |
36 | echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' | 41 | echo 'spatch is part of the Coccinelle project and is available at http://coccinelle.lip6.fr/' |
37 | exit 1 | 42 | exit 1 |
@@ -72,7 +77,7 @@ coccinelle () { | |||
72 | # | 77 | # |
73 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null | 78 | # $SPATCH -D $MODE $FLAGS -parse_cocci $COCCI $OPT > /dev/null |
74 | 79 | ||
75 | if [ $VERBOSE -ne 0 ] ; then | 80 | if [ $VERBOSE -ne 0 -a $ONLINE -eq 0 ] ; then |
76 | 81 | ||
77 | FILE=`echo $COCCI | sed "s|$srctree/||"` | 82 | FILE=`echo $COCCI | sed "s|$srctree/||"` |
78 | 83 | ||