diff options
author | Nicolas Palix <nicolas.palix@imag.fr> | 2013-03-02 22:36:26 +0100 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2013-04-08 15:42:02 +0200 |
commit | 9e395550779efa07ee00809a041534b9641fb7a7 (patch) | |
tree | 0666278552bbca21cb60d97f5bf806dcf1591f88 /scripts | |
parent | 35d88a38710583f3b5afc3255d7bc190a50e1af7 (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')
-rwxr-xr-x | scripts/coccicheck | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/scripts/coccicheck b/scripts/coccicheck index 7f0d6a6c500..cdde8e0670a 100755 --- a/scripts/coccicheck +++ b/scripts/coccicheck @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash SPATCH="`which ${SPATCH:=spatch}`" @@ -11,24 +11,25 @@ else VERBOSE=0 fi +FLAGS="-very_quiet" + +# spatch only allows include directories with the syntax "-I include" +# while gcc also allows "-Iinclude" and "-include include" +COCCIINCLUDE=${LINUXINCLUDE//-I/-I } +COCCIINCLUDE=${COCCIINCLUDE//-include/-I} + if [ "$C" = "1" -o "$C" = "2" ]; then ONLINE=1 -# This requires Coccinelle >= 0.2.3 -# FLAGS="-ignore_unknown_options -very_quiet" -# OPTIONS=$* - -# Workaround for Coccinelle < 0.2.3 - FLAGS="-I $srctree/include -very_quiet" - shift $(( $# - 1 )) - OPTIONS=$1 + # Take only the last argument, which is the C file to test + shift $(( $# - 1 )) + OPTIONS="$COCCIINCLUDE $1" else ONLINE=0 - FLAGS="-very_quiet" if [ "$KBUILD_EXTMOD" = "" ] ; then - OPTIONS="-dir $srctree" + OPTIONS="-dir $srctree $COCCIINCLUDE" else - OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" + OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE" fi fi |