Skip to content

Commit

Permalink
Merge neovim#15774 fix(pvs): fix warnings, script
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmk authored Sep 24, 2021
2 parents 55d1e63 + 03ed726 commit bc570b0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions scripts/pvscheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -373,13 +373,13 @@ run_analysis() {(
analyze \
--lic-file PVS-Studio.lic \
--threads "$(get_jobs_num)" \
--exclude-path src/nvim/xdiff \
--exclude-path src/xdiff \
--output-file PVS-studio.log \
--file build/compile_commands.json \
--sourcetree-root . || true

rm -rf PVS-studio.{xml,err,tsk,html.d}
local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042"
local plog_args="PVS-studio.log --srcRoot . --excludedCodes V011,V1042,V1051,V1074"
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
Expand Down
5 changes: 3 additions & 2 deletions src/nvim/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -3112,12 +3112,13 @@ void fileinfo(int fullname, // when non-zero print full path
(size_t)(IOSIZE - (p - buffer)), true);
}

bool dontwrite = bt_dontwrite(curbuf);
vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s",
curbufIsChanged()
? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
(curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
(curbuf->b_flags & BF_NOTEDITED) && !dontwrite
? _("[Not edited]") : "",
(curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
(curbuf->b_flags & BF_NEW) && !dontwrite
? new_file_message() : "",
(curbuf->b_flags & BF_READERR)
? _("[Read errors]") : "",
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -6193,7 +6193,7 @@ int assert_inrange(typval_T *argvars)
char msg[55];
vim_snprintf(msg, sizeof(msg),
"range %" PRIdVARNUMBER " - %" PRIdVARNUMBER ",",
lower, upper);
lower, upper); // -V576
fill_assert_error(&ga, &argvars[3], (char_u *)msg, NULL, &argvars[2],
ASSERT_INRANGE);
assert_error(&ga);
Expand Down
2 changes: 1 addition & 1 deletion src/nvim/ex_cmds2.c
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
save_sourcing_lnum);
sourcing_name = sourcing_name_buf;
sourcing_name = sourcing_name_buf; // -V507 reassigned below, before return.
}
sourcing_lnum = 0;

Expand Down
6 changes: 3 additions & 3 deletions src/nvim/ex_session.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,11 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
}
} else if (fprintf(fd,
"let s:l = %" PRIdLINENR " - ((%" PRIdLINENR
" * winheight(0) + %" PRId64 ") / %" PRId64 ")\n",
" * winheight(0) + %d) / %d)\n",
wp->w_cursor.lnum,
wp->w_cursor.lnum - wp->w_topline,
(int64_t)(wp->w_height_inner / 2),
(int64_t)wp->w_height_inner) < 0) {
(wp->w_height_inner / 2),
wp->w_height_inner) < 0) {
return FAIL;
}
if (fprintf(fd,
Expand Down
2 changes: 2 additions & 0 deletions src/nvim/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ void *xrealloc(void *ptr, size_t size)

/// xmalloc() wrapper that allocates size + 1 bytes and zeroes the last byte
///
/// Commonly used to allocate strings, e.g. `char *s = xmallocz(len)`.
///
/// @see {xmalloc}
/// @param size
/// @return pointer to allocated space. Never NULL
Expand Down

0 comments on commit bc570b0

Please sign in to comment.