mirror of
https://github.com/neovim/neovim.git
synced 2025-12-10 16:42:42 +00:00
Merge #9471 from justinmk/pvs-warnings
This commit is contained in:
@@ -447,7 +447,8 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (win_valid_any_tab(win)) {
|
if (win != NULL // Avoid bogus clang warning.
|
||||||
|
&& win_valid_any_tab(win)) {
|
||||||
// Set b_last_cursor when closing the last window for the buffer.
|
// Set b_last_cursor when closing the last window for the buffer.
|
||||||
// Remember the last cursor position and window options of the buffer.
|
// Remember the last cursor position and window options of the buffer.
|
||||||
// This used to be only for the current window, but then options like
|
// This used to be only for the current window, but then options like
|
||||||
@@ -575,7 +576,9 @@ void close_buffer(win_T *win, buf_T *buf, int action, int abort_if_last)
|
|||||||
if (buf == curbuf && !is_curbuf)
|
if (buf == curbuf && !is_curbuf)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (win_valid_any_tab(win) && win->w_buffer == buf) {
|
if (win != NULL // Avoid bogus clang warning.
|
||||||
|
&& win_valid_any_tab(win)
|
||||||
|
&& win->w_buffer == buf) {
|
||||||
win->w_buffer = NULL; // make sure we don't use the buffer now
|
win->w_buffer = NULL; // make sure we don't use the buffer now
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -394,7 +394,8 @@ void check_cursor_col_win(win_T *win)
|
|||||||
// Make sure that coladd is not more than the char width.
|
// Make sure that coladd is not more than the char width.
|
||||||
// Not for the last character, coladd is then used when the cursor
|
// Not for the last character, coladd is then used when the cursor
|
||||||
// is actually after the last character.
|
// is actually after the last character.
|
||||||
if (win->w_cursor.col + 1 < len && win->w_cursor.coladd > 0) {
|
if (win->w_cursor.col + 1 < len) {
|
||||||
|
assert(win->w_cursor.coladd > 0);
|
||||||
int cs, ce;
|
int cs, ce;
|
||||||
|
|
||||||
getvcol(win, &win->w_cursor, &cs, NULL, &ce);
|
getvcol(win, &win->w_cursor, &cs, NULL, &ce);
|
||||||
|
|||||||
@@ -88,12 +88,13 @@ char_u *parse_shape_opt(int what)
|
|||||||
char_u *colonp;
|
char_u *colonp;
|
||||||
char_u *commap;
|
char_u *commap;
|
||||||
char_u *slashp;
|
char_u *slashp;
|
||||||
char_u *p, *endp;
|
char_u *p = NULL;
|
||||||
int idx = 0; /* init for GCC */
|
char_u *endp;
|
||||||
|
int idx = 0; // init for GCC
|
||||||
int all_idx;
|
int all_idx;
|
||||||
int len;
|
int len;
|
||||||
int i;
|
int i;
|
||||||
int found_ve = false; /* found "ve" flag */
|
int found_ve = false; // found "ve" flag
|
||||||
int round;
|
int round;
|
||||||
|
|
||||||
// First round: check for errors; second round: do it for real.
|
// First round: check for errors; second round: do it for real.
|
||||||
|
|||||||
@@ -10103,6 +10103,7 @@ Dictionary commands_array(buf_T *buf)
|
|||||||
{
|
{
|
||||||
Dictionary rv = ARRAY_DICT_INIT;
|
Dictionary rv = ARRAY_DICT_INIT;
|
||||||
Object obj = NIL;
|
Object obj = NIL;
|
||||||
|
(void)obj; // Avoid "dead assignment" warning.
|
||||||
char str[10];
|
char str[10];
|
||||||
garray_T *gap = (buf == NULL) ? &ucmds : &buf->b_ucmds;
|
garray_T *gap = (buf == NULL) ? &ucmds : &buf->b_ucmds;
|
||||||
|
|
||||||
|
|||||||
@@ -1808,7 +1808,6 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
if (has_event(EVENT_CMDLINECHANGED)) {
|
if (has_event(EVENT_CMDLINECHANGED)) {
|
||||||
TryState tstate;
|
TryState tstate;
|
||||||
Error err = ERROR_INIT;
|
Error err = ERROR_INIT;
|
||||||
bool tl_ret = true;
|
|
||||||
dict_T *dict = get_vim_var_dict(VV_EVENT);
|
dict_T *dict = get_vim_var_dict(VV_EVENT);
|
||||||
|
|
||||||
char firstcbuf[2];
|
char firstcbuf[2];
|
||||||
@@ -1825,14 +1824,13 @@ static int command_line_changed(CommandLineState *s)
|
|||||||
(char_u *)firstcbuf, false, curbuf);
|
(char_u *)firstcbuf, false, curbuf);
|
||||||
tv_dict_clear(dict);
|
tv_dict_clear(dict);
|
||||||
|
|
||||||
tl_ret = try_leave(&tstate, &err);
|
bool tl_ret = try_leave(&tstate, &err);
|
||||||
if (!tl_ret && ERROR_SET(&err)) {
|
if (!tl_ret && ERROR_SET(&err)) {
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
msg_printf_attr(HL_ATTR(HLF_E)|MSG_HIST, (char *)e_autocmd_err, err.msg);
|
msg_printf_attr(HL_ATTR(HLF_E)|MSG_HIST, (char *)e_autocmd_err, err.msg);
|
||||||
api_clear_error(&err);
|
api_clear_error(&err);
|
||||||
redrawcmd();
|
redrawcmd();
|
||||||
}
|
}
|
||||||
tl_ret = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 'incsearch' highlighting.
|
// 'incsearch' highlighting.
|
||||||
@@ -5933,6 +5931,7 @@ void ex_history(exarg_T *eap)
|
|||||||
|
|
||||||
for (; !got_int && histype1 <= histype2; ++histype1) {
|
for (; !got_int && histype1 <= histype2; ++histype1) {
|
||||||
STRCPY(IObuff, "\n # ");
|
STRCPY(IObuff, "\n # ");
|
||||||
|
assert(history_names[histype1] != NULL);
|
||||||
STRCAT(STRCAT(IObuff, history_names[histype1]), " history");
|
STRCAT(STRCAT(IObuff, history_names[histype1]), " history");
|
||||||
MSG_PUTS_TITLE(IObuff);
|
MSG_PUTS_TITLE(IObuff);
|
||||||
idx = hisidx[histype1];
|
idx = hisidx[histype1];
|
||||||
|
|||||||
@@ -760,8 +760,6 @@ readfile (
|
|||||||
fenc = (char_u *)"utf-8";
|
fenc = (char_u *)"utf-8";
|
||||||
|
|
||||||
fenc_alloced = false;
|
fenc_alloced = false;
|
||||||
|
|
||||||
c = 1;
|
|
||||||
} else if (*p_fencs == NUL) {
|
} else if (*p_fencs == NUL) {
|
||||||
fenc = curbuf->b_p_fenc; /* use format from buffer */
|
fenc = curbuf->b_p_fenc; /* use format from buffer */
|
||||||
fenc_alloced = FALSE;
|
fenc_alloced = FALSE;
|
||||||
|
|||||||
@@ -1371,6 +1371,8 @@ static char *cs_manage_matches(char **matches, char **contexts,
|
|||||||
next = 0;
|
next = 0;
|
||||||
break;
|
break;
|
||||||
case Print:
|
case Print:
|
||||||
|
assert(mp != NULL);
|
||||||
|
assert(cp != NULL);
|
||||||
cs_print_tags_priv(mp, cp, cnt);
|
cs_print_tags_priv(mp, cp, cnt);
|
||||||
break;
|
break;
|
||||||
default: // should not reach here
|
default: // should not reach here
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ static int mouse_adjust_click(win_T *wp, int row, int col)
|
|||||||
linenr_T lnum = wp->w_cursor.lnum;
|
linenr_T lnum = wp->w_cursor.lnum;
|
||||||
char_u *line = ml_get(lnum);
|
char_u *line = ml_get(lnum);
|
||||||
char_u *ptr = line;
|
char_u *ptr = line;
|
||||||
char_u *ptr_end = line;
|
char_u *ptr_end;
|
||||||
char_u *ptr_row_offset = line; // Where we begin adjusting `ptr_end`
|
char_u *ptr_row_offset = line; // Where we begin adjusting `ptr_end`
|
||||||
|
|
||||||
// Find the offset where scanning should begin.
|
// Find the offset where scanning should begin.
|
||||||
|
|||||||
@@ -3770,6 +3770,7 @@ find_decl (
|
|||||||
clearpos(&found_pos);
|
clearpos(&found_pos);
|
||||||
for (;; ) {
|
for (;; ) {
|
||||||
valid = false;
|
valid = false;
|
||||||
|
(void)valid; // Avoid "dead assignment" warning.
|
||||||
t = searchit(curwin, curbuf, &curwin->w_cursor, FORWARD,
|
t = searchit(curwin, curbuf, &curwin->w_cursor, FORWARD,
|
||||||
pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL);
|
pat, 1L, searchflags, RE_LAST, (linenr_T)0, NULL);
|
||||||
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
if (curwin->w_cursor.lnum >= old_pos.lnum)
|
||||||
|
|||||||
@@ -2038,12 +2038,11 @@ int expand_wildcards(int num_pat, char_u **pat, int *num_files, char_u ***files,
|
|||||||
if (*p_wig) {
|
if (*p_wig) {
|
||||||
char_u *ffname;
|
char_u *ffname;
|
||||||
|
|
||||||
// check all filess in (*files)[]
|
// check all files in (*files)[]
|
||||||
for (i = 0; i < *num_files; i++) {
|
for (i = 0; i < *num_files; i++) {
|
||||||
ffname = (char_u *)FullName_save((char *)(*files)[i], false);
|
ffname = (char_u *)FullName_save((char *)(*files)[i], false);
|
||||||
if (ffname == NULL) { // out of memory
|
assert((*files)[i] != NULL);
|
||||||
break;
|
assert(ffname != NULL);
|
||||||
}
|
|
||||||
if (match_file_list(p_wig, (*files)[i], ffname)) {
|
if (match_file_list(p_wig, (*files)[i], ffname)) {
|
||||||
// remove this matching file from the list
|
// remove this matching file from the list
|
||||||
xfree((*files)[i]);
|
xfree((*files)[i]);
|
||||||
|
|||||||
@@ -4820,8 +4820,9 @@ static void win_redr_status(win_T *wp, int ignore_pum)
|
|||||||
if (wp->w_buffer->b_help
|
if (wp->w_buffer->b_help
|
||||||
|| wp->w_p_pvw
|
|| wp->w_p_pvw
|
||||||
|| bufIsChanged(wp->w_buffer)
|
|| bufIsChanged(wp->w_buffer)
|
||||||
|| wp->w_buffer->b_p_ro)
|
|| wp->w_buffer->b_p_ro) {
|
||||||
*(p + len++) = ' ';
|
*(p + len++) = ' ';
|
||||||
|
}
|
||||||
if (wp->w_buffer->b_help) {
|
if (wp->w_buffer->b_help) {
|
||||||
STRCPY(p + len, _("[Help]"));
|
STRCPY(p + len, _("[Help]"));
|
||||||
len += (int)STRLEN(p + len);
|
len += (int)STRLEN(p + len);
|
||||||
@@ -4836,7 +4837,7 @@ static void win_redr_status(win_T *wp, int ignore_pum)
|
|||||||
}
|
}
|
||||||
if (wp->w_buffer->b_p_ro) {
|
if (wp->w_buffer->b_p_ro) {
|
||||||
STRCPY(p + len, _("[RO]"));
|
STRCPY(p + len, _("[RO]"));
|
||||||
len += (int)STRLEN(p + len);
|
// len += (int)STRLEN(p + len); // dead assignment
|
||||||
}
|
}
|
||||||
|
|
||||||
this_ru_col = ru_col - (Columns - wp->w_width);
|
this_ru_col = ru_col - (Columns - wp->w_width);
|
||||||
|
|||||||
@@ -599,6 +599,7 @@ static inline void hmll_insert(HMLList *const hmll,
|
|||||||
if (hmll_entry == hmll->first) {
|
if (hmll_entry == hmll->first) {
|
||||||
hmll_entry = NULL;
|
hmll_entry = NULL;
|
||||||
}
|
}
|
||||||
|
assert(hmll->first != NULL);
|
||||||
hmll_remove(hmll, hmll->first);
|
hmll_remove(hmll, hmll->first);
|
||||||
}
|
}
|
||||||
HMLListEntry *target_entry;
|
HMLListEntry *target_entry;
|
||||||
|
|||||||
Reference in New Issue
Block a user