From 14b26b309ea3b93a2fce66225c632445fd020e67 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 16 May 2017 12:18:11 +0300 Subject: [PATCH] generic_data: fix up some project related things for smatch_generic 1) Accept the "-p " argument for when people want to build their own project. 2) Add a basically empty list of too common functions and an empty script to fix up the DB. There is already a fixup_all.sh to fixup the DB. 3) Pass the project argument to the DB when you build it. Reported-by: Randy Dunlap Signed-off-by: Dan Carpenter --- smatch_data/db/fixup_smatch_generic.sh | 0 smatch_data/smatch_generic.common_functions | 1 + smatch_scripts/build_generic_data.sh | 9 +++++++-- 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100755 smatch_data/db/fixup_smatch_generic.sh create mode 100644 smatch_data/smatch_generic.common_functions diff --git a/smatch_data/db/fixup_smatch_generic.sh b/smatch_data/db/fixup_smatch_generic.sh new file mode 100755 index 00000000..e69de29b diff --git a/smatch_data/smatch_generic.common_functions b/smatch_data/smatch_generic.common_functions new file mode 100644 index 00000000..f3be370b --- /dev/null +++ b/smatch_data/smatch_generic.common_functions @@ -0,0 +1 @@ +printf diff --git a/smatch_scripts/build_generic_data.sh b/smatch_scripts/build_generic_data.sh index d823e6ed..27ad013b 100755 --- a/smatch_scripts/build_generic_data.sh +++ b/smatch_scripts/build_generic_data.sh @@ -13,6 +13,7 @@ function usage { echo echo "Usage: $0" echo "Updates the smatch_data/ directory and builds the smatch database" + echo " -p (default = $PROJECT)" echo exit 1 } @@ -22,6 +23,10 @@ while true ; do shift TARGET="$1" shift + elif [ "$1" == "-p" ] || [ "$1" == "--project" ] ; then + shift + PROJECT="$1" + shift elif [ "$1" == "--help" ] || [ "$1" = "-h" ] ; then usage else @@ -40,7 +45,7 @@ fi # required packages are installed if [ ! -e smatch_db.sqlite ] ; then [ -e smatch_warns.txt ] || touch smatch_warns.txt - if ! $SCRIPT_DIR/../smatch_data/db/create_db.sh -p=kernel smatch_warns.txt ; then + if ! $SCRIPT_DIR/../smatch_data/db/create_db.sh -p=$PROJECT smatch_warns.txt ; then echo "Hm... Not working. Make sure you have all the sqlite3 packages" echo "And the sqlite3 libraries for Perl and Python" exit 1 @@ -58,5 +63,5 @@ done mkdir -p $DATA_DIR mv $PROJECT.* $DATA_DIR -$SCRIPT_DIR/../smatch_data/db/create_db.sh smatch_warns.txt +$SCRIPT_DIR/../smatch_data/db/create_db.sh -p=$PROJECT smatch_warns.txt -- 2.11.4.GIT