neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 933274c438107adadde5ff854340ed1fae18d3fe
parent 68d27e156ce42f1c8428a8deb5206e4c16cb14d4
Author: dundargoc <33953936+dundargoc@users.noreply.github.com>
Date:   Mon, 25 Apr 2022 03:51:22 +0200

fix/PVS #17863

* fix(PVS/V002): disable rule completely

V002: "Some diagnostic messages may contain incorrect line number in
this file." This particular check seems unreliable. It says on their
website https://pvs-studio.com/en/docs/warnings/v002/ that this warning
occurs when there are multiline pragmas, but there are none in
extmark.c.

* fix(PVS/V756): ignore "counter is not used inside a nested loop" warning

The nested loop starts with "AutoCmd *ac = ap->cmds" so "ap" is
definitely used.

* fix(PVS/V560): disable "a part of conditional expression is always true"

* fix(PVS/V614): potentially uninitialized variable 'blen' used
Diffstat:
Mscripts/pvscheck.sh | 2+-
Msrc/nvim/autocmd.c | 2+-
Msrc/nvim/fileio.c | 2+-
Msrc/nvim/fold.c | 1+
4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/pvscheck.sh b/scripts/pvscheck.sh @@ -380,7 +380,7 @@ run_analysis() {( --sourcetree-root . || true rm -rf PVS-studio.{xml,err,tsk,html.d} - local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042,V1051,V1074" + local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042,V1051,V1074,V002" plog-converter $plog_args --renderTypes xml --output PVS-studio.xml plog-converter $plog_args --renderTypes errorfile --output PVS-studio.err plog-converter $plog_args --renderTypes tasklist --output PVS-studio.tsk diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c @@ -2449,7 +2449,7 @@ bool autocmd_delete_id(int64_t id) // Note that since multiple AutoCmd objects can have the same ID, we need to do a full scan. FOR_ALL_AUEVENTS(event) { - FOR_ALL_AUPATS_IN_EVENT(event, ap) { + FOR_ALL_AUPATS_IN_EVENT(event, ap) { // -V756 for (AutoCmd *ac = ap->cmds; ac != NULL; ac = ac->next) { if (ac->id == id) { aucmd_del(ac); diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c @@ -1118,7 +1118,7 @@ retry: && tmpname == NULL && (*fenc == 'u' || *fenc == NUL)))) { char_u *ccname; - int blen; + int blen = 0; // no BOM detection in a short file or in binary mode if (size < 2 || curbuf->b_p_bin) { diff --git a/src/nvim/fold.c b/src/nvim/fold.c @@ -2752,6 +2752,7 @@ static void truncate_fold(win_T *const wp, fold_T *fp, linenr_T end) } #define FOLD_END(fp) ((fp)->fd_top + (fp)->fd_len - 1) +// -V:VALID_FOLD:V560 #define VALID_FOLD(fp, gap) \ ((gap)->ga_len > 0 && (fp) < ((fold_T *)(gap)->ga_data + (gap)->ga_len)) #define FOLD_INDEX(fp, gap) ((size_t)((fp) - ((fold_T *)(gap)->ga_data)))