From 793496aecc23fdee93040fc94ca3e1a66da73039 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 15 May 2022 15:04:56 +0200 Subject: fix PVS warnings (#18459) * fix(PVS/V547): remove ifs that are always true or false * fix(PVS/V560): remove partial conditions that are always true * fix(PVS/V1044): suppress warning about loop break conditions * fix(PVS/V1063): suppress "modulo by 1 operation is meaningless" * fix(PVS/V568): suppress "operator evaluates the size of a pointer" Also mark vim-patch:8.2.4958 as ported. --- src/nvim/eval/funcs.c | 28 +++++++++++++--------------- src/nvim/eval/typval_encode.c.h | 2 ++ 2 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/nvim/eval') diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c index ee00736b63..04e9ffa570 100644 --- a/src/nvim/eval/funcs.c +++ b/src/nvim/eval/funcs.c @@ -9711,26 +9711,24 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv, FunPtr fptr) return; } - if (*curwin->w_s->b_p_spl != NUL) { - const char *const str = tv_get_string(&argvars[0]); - if (argvars[1].v_type != VAR_UNKNOWN) { - maxcount = tv_get_number_chk(&argvars[1], &typeerr); - if (maxcount <= 0) { + const char *const str = tv_get_string(&argvars[0]); + if (argvars[1].v_type != VAR_UNKNOWN) { + maxcount = tv_get_number_chk(&argvars[1], &typeerr); + if (maxcount <= 0) { + goto f_spellsuggest_return; + } + if (argvars[2].v_type != VAR_UNKNOWN) { + need_capital = tv_get_number_chk(&argvars[2], &typeerr); + if (typeerr) { goto f_spellsuggest_return; } - if (argvars[2].v_type != VAR_UNKNOWN) { - need_capital = tv_get_number_chk(&argvars[2], &typeerr); - if (typeerr) { - goto f_spellsuggest_return; - } - } - } else { - maxcount = 25; } - - spell_suggest_list(&ga, (char_u *)str, maxcount, need_capital, false); + } else { + maxcount = 25; } + spell_suggest_list(&ga, (char_u *)str, maxcount, need_capital, false); + f_spellsuggest_return: tv_list_alloc_ret(rettv, (ptrdiff_t)ga.ga_len); for (int i = 0; i < ga.ga_len; i++) { diff --git a/src/nvim/eval/typval_encode.c.h b/src/nvim/eval/typval_encode.c.h index bd23fb4154..8c952473a1 100644 --- a/src/nvim/eval/typval_encode.c.h +++ b/src/nvim/eval/typval_encode.c.h @@ -250,6 +250,8 @@ #include "nvim/func_attr.h" #include "nvim/lib/kvec.h" +// -V::1063 + /// Dummy variable used because some macros need lvalue /// /// Must not be written to, if needed one must check that address of the -- cgit