aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/coccicheck
diff options
context:
space:
mode:
authorNicolas Palix <nicolas.palix@imag.fr>2013-03-02 16:36:26 -0500
committerMichal Marek <mmarek@suse.cz>2013-04-08 09:42:02 -0400
commit9e395550779efa07ee00809a041534b9641fb7a7 (patch)
tree0666278552bbca21cb60d97f5bf806dcf1591f88 /scripts/coccicheck
parent35d88a38710583f3b5afc3255d7bc190a50e1af7 (diff)
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. Signed-off-by: Nicolas Palix <nicolas.palix@imag.fr> Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/coccicheck')
-rwxr-xr-xscripts/coccicheck25
1 files changed, 13 insertions, 12 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck
index 7f0d6a6c5000..cdde8e0670aa 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,24 +11,25 @@ else
11 VERBOSE=0 11 VERBOSE=0
12fi 12fi
13 13
14FLAGS="-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 -patch $srctree $COCCIINCLUDE"
32 fi 33 fi
33fi 34fi
34 35