aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccicheck
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/coccicheck')
-rwxr-xr-xscripts/coccicheck31
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
3SPATCH="`which ${SPATCH:=spatch}`" 3SPATCH="`which ${SPATCH:=spatch}`"
4 4
@@ -11,27 +11,32 @@ else
11 VERBOSE=0 11 VERBOSE=0
12fi 12fi
13 13
14FLAGS="$SPFLAGS -very_quiet"
15
16# spatch only allows include directories with the syntax "-I include"
17# while gcc also allows "-Iinclude" and "-include include"
18COCCIINCLUDE=${LINUXINCLUDE//-I/-I }
19COCCIINCLUDE=${COCCIINCLUDE//-include/-I}
20
14if [ "$C" = "1" -o "$C" = "2" ]; then 21if [ "$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
25else 27else
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
33fi 34fi
34 35
36if [ "$KBUILD_EXTMOD" != "" ] ; then
37 OPTIONS="-patch $srctree $OPTIONS"
38fi
39
35if [ ! -x "$SPATCH" ]; then 40if [ ! -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