From 65993c444a43b37fc7b314cbd8287f45bc3d13f7 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 10 Nov 2020 09:42:28 -0500 Subject: [PATCH 1/3] Use the free PVS-Studio license As of release 7.10, PVS Studio requires a license, even for the "check me" comment based analyzing. --- scripts/pvscheck.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index c09e8c4555..1efde4223d 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -363,10 +363,15 @@ run_analysis() {( cd "$tgt" + if [ ! -r PVS-Studio.lic ]; then + pvs-studio-analyzer credentials -o PVS-Studio.lic 'PVS-Studio Free' 'FREE-FREE-FREE-FREE' + fi + # pvs-studio-analyzer exits with a non-zero exit code when there are detected # errors, so ignore its return pvs-studio-analyzer \ analyze \ + --lic-file PVS-Studio.lic \ --threads "$(get_jobs_num)" \ --output-file PVS-studio.log \ --file build/compile_commands.json \ From 088161a9459a6afed84ea07ef28912e2489bc286 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 10 Nov 2020 09:52:45 -0500 Subject: [PATCH 2/3] pvs: Exclude xdiff from analysis and comment munging --- scripts/pvscheck.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh index 1efde4223d..f054f6e6fe 100755 --- a/scripts/pvscheck.sh +++ b/scripts/pvscheck.sh @@ -346,7 +346,7 @@ patch_sources() {( if test "$only_build" != "--only-build" ; then find \ src/nvim test/functional/fixtures test/unit/fixtures \ - -name '*.c' \ + \( -name '*.c' -a '!' -path '*xdiff*' \) \ -exec /bin/sh -c "$sh_script" - '{}' \; fi @@ -373,6 +373,7 @@ run_analysis() {( analyze \ --lic-file PVS-Studio.lic \ --threads "$(get_jobs_num)" \ + --exclude-path src/nvim/xdiff \ --output-file PVS-studio.log \ --file build/compile_commands.json \ --sourcetree-root . || true From 31366c44c45e7ffd402a350b34a841340de9fe5f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 10 Nov 2020 10:01:05 -0500 Subject: [PATCH 3/3] Add PVS comment to new source files --- src/nvim/decoration.c | 3 +-- test/functional/fixtures/streams-test.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/nvim/decoration.c b/src/nvim/decoration.c index 0721c0c57b..03ce2a37b5 100644 --- a/src/nvim/decoration.c +++ b/src/nvim/decoration.c @@ -1,7 +1,6 @@ // This is an open source non-commercial project. Dear PVS-Studio, please check // it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com -// -// + #include "nvim/vim.h" #include "nvim/extmark.h" #include "nvim/decoration.h" diff --git a/test/functional/fixtures/streams-test.c b/test/functional/fixtures/streams-test.c index 56d475d7dc..eec447153c 100644 --- a/test/functional/fixtures/streams-test.c +++ b/test/functional/fixtures/streams-test.c @@ -1,3 +1,6 @@ +// This is an open source non-commercial project. Dear PVS-Studio, please check +// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com + /// Helper program to exit and keep stdout open (like "xclip -i -loops 1"). #include