Merge pull request #6961 from ZyX-I/pvscheck-cc

pvscheck: Add --environment-cc switch
This commit is contained in:
Nikolai Aleksandrovich Pavlov 2017-07-04 19:27:12 +03:00 committed by GitHub
commit 957a6506ef

View File

@ -19,8 +19,11 @@ get_jobs_num() {
help() { help() {
echo 'Usage:' echo 'Usage:'
echo ' pvscheck.sh [--pvs URL] [--deps] [target-directory [branch]]' echo ' pvscheck.sh [--pvs URL] [--deps] [--environment-cc]'
echo ' pvscheck.sh [--pvs URL] [--recheck|--only-analyse] [target-directory]' echo ' [target-directory [branch]]'
echo ' pvscheck.sh [--pvs URL] [--recheck] [--environment-cc]'
echo ' [target-directory]'
echo ' pvscheck.sh [--pvs URL] --only-analyse [target-directory]'
echo ' pvscheck.sh [--pvs URL] --pvs-install {target-directory}' echo ' pvscheck.sh [--pvs URL] --pvs-install {target-directory}'
echo ' pvscheck.sh --patch [--only-build]' echo ' pvscheck.sh --patch [--only-build]'
echo echo
@ -35,6 +38,9 @@ help() {
echo ' Without this it assumes all dependencies are already' echo ' Without this it assumes all dependencies are already'
echo ' installed.' echo ' installed.'
echo echo
echo ' --environment-cc: (for regular run and --recheck) Do not export'
echo ' CC=clang. Build is still run with CFLAGS=-O0.'
echo
echo ' --only-build: (for --patch) Only patch files in ./build directory.' echo ' --only-build: (for --patch) Only patch files in ./build directory.'
echo echo
echo ' --pvs-install: Only install PVS-studio to the specified location.' echo ' --pvs-install: Only install PVS-studio to the specified location.'
@ -270,8 +276,11 @@ install_pvs() {(
create_compile_commands() {( create_compile_commands() {(
local tgt="$1" ; shift local tgt="$1" ; shift
local deps="$1" ; shift local deps="$1" ; shift
local environment_cc="$1" ; shift
if test -z "$environment_cc" ; then
export CC=clang export CC=clang
fi
export CFLAGS=' -O0 ' export CFLAGS=' -O0 '
if test -z "$deps" ; then if test -z "$deps" ; then
@ -356,19 +365,21 @@ do_check() {
local branch="$1" ; shift local branch="$1" ; shift
local pvs_url="$1" ; shift local pvs_url="$1" ; shift
local deps="$1" ; shift local deps="$1" ; shift
local environment_cc="$1" ; shift
git clone --branch="$branch" . "$tgt" git clone --branch="$branch" . "$tgt"
install_pvs "$tgt" "$pvs_url" install_pvs "$tgt" "$pvs_url"
do_recheck "$tgt" "$deps" do_recheck "$tgt" "$deps" "$environment_cc"
} }
do_recheck() { do_recheck() {
local tgt="$1" ; shift local tgt="$1" ; shift
local deps="$1" ; shift local deps="$1" ; shift
local environment_cc="$1" ; shift
create_compile_commands "$tgt" "$deps" create_compile_commands "$tgt" "$deps" "$environment_cc"
do_analysis "$tgt" do_analysis "$tgt"
} }
@ -408,6 +419,7 @@ main() {
only-analyse store_const \ only-analyse store_const \
pvs-install store_const \ pvs-install store_const \
deps store_const \ deps store_const \
environment-cc store_const \
-- \ -- \
'modify realdir tgt "$PWD/../neovim-pvs"' \ 'modify realdir tgt "$PWD/../neovim-pvs"' \
'store branch master' \ 'store branch master' \
@ -426,11 +438,11 @@ main() {
elif test -n "$pvs_install" ; then elif test -n "$pvs_install" ; then
install_pvs "$tgt" "$pvs_url" install_pvs "$tgt" "$pvs_url"
elif test -n "$recheck" ; then elif test -n "$recheck" ; then
do_recheck "$tgt" "$deps" do_recheck "$tgt" "$deps" "$environment_cc"
elif test -n "$only_analyse" ; then elif test -n "$only_analyse" ; then
do_analysis "$tgt" do_analysis "$tgt"
else else
do_check "$tgt" "$branch" "$pvs_url" "$deps" do_check "$tgt" "$branch" "$pvs_url" "$deps" "$environment_cc"
fi fi
} }