提交 9e395550 编写于 作者: N Nicolas Palix 提交者: Michal Marek

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: NNicolas Palix <nicolas.palix@imag.fr>
Signed-off-by: NMichal Marek <mmarek@suse.cz>
上级 35d88a38
#!/bin/sh #!/bin/bash
SPATCH="`which ${SPATCH:=spatch}`" SPATCH="`which ${SPATCH:=spatch}`"
...@@ -11,24 +11,25 @@ else ...@@ -11,24 +11,25 @@ else
VERBOSE=0 VERBOSE=0
fi 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 if [ "$C" = "1" -o "$C" = "2" ]; then
ONLINE=1 ONLINE=1
# This requires Coccinelle >= 0.2.3 # Take only the last argument, which is the C file to test
# FLAGS="-ignore_unknown_options -very_quiet" shift $(( $# - 1 ))
# OPTIONS=$* OPTIONS="$COCCIINCLUDE $1"
# Workaround for Coccinelle < 0.2.3
FLAGS="-I $srctree/include -very_quiet"
shift $(( $# - 1 ))
OPTIONS=$1
else else
ONLINE=0 ONLINE=0
FLAGS="-very_quiet"
if [ "$KBUILD_EXTMOD" = "" ] ; then if [ "$KBUILD_EXTMOD" = "" ] ; then
OPTIONS="-dir $srctree" OPTIONS="-dir $srctree $COCCIINCLUDE"
else else
OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree -I $srctree/include -I $KBUILD_EXTMOD/include" OPTIONS="-dir $KBUILD_EXTMOD -patch $srctree $COCCIINCLUDE"
fi fi
fi fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册