scripts: coccicheck: Add support for SPFLAGS

SPFLAGS allows to pass additional flags supported by
spatch during transformation.

Both short notation `-f=` and `--sp-flag=` can be used
to pass the flag to the coccicheck.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
This commit is contained in:
Himanshu Jha 2019-02-05 14:30:32 +05:30 committed by Anas Nashif
parent 870e5cb53e
commit b2fa9db074

View File

@ -1,8 +1,6 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
#
# Read doc/application/coccinelle.rst
#
ZEPHYR_BASE=$( builtin cd "$( dirname "$DIR" )" && pwd ${PWD_OPT})
DIR="$(dirname $(readlink -f $0))/.."
@ -24,6 +22,7 @@ OPTIONS:
-j= , --jobs= number of jobs to use {0 - `nproc`}
-c= , --cocci= specify cocci script to use
-d= , --debug= specify file to store debug log
-f= , --sp-flag= pass additional flag to spatch
-h , --help display help and exit
Default values if any OPTION is not supplied:
@ -61,6 +60,10 @@ do
DEBUG_FILE="${i#*=}"
shift
;;
-f=*|--sp-flag=*)
SPFLAGS="${i#*=}"
shift
;;
-h|--help)
echo "$usage"
exit 1
@ -133,6 +136,9 @@ run_cmd_parmap() {
fi
}
# You can override heuristics with SPFLAGS, these must always go last
OPTIONS="$OPTIONS $SPFLAGS"
coccinelle () {
COCCI="$1"
OPT=`grep "Options:" $COCCI | cut -d':' -f2`