1
0
forked from aniani/vim

patch 9.0.0364: clang static analyzer gives warnings

Problem:    Clang static analyzer gives warnings.
Solution:   Avoid the warnings. (Yegappan Lakshmanan, closes #11043)
This commit is contained in:
Yegappan Lakshmanan 2022-09-03 10:52:24 +01:00 committed by Bram Moolenaar
parent b18b496997
commit c99e182e1f
8 changed files with 15 additions and 13 deletions

View File

@ -1089,7 +1089,6 @@ ex_let(exarg_T *eap)
{ {
// +=, /=, etc. require an existing variable // +=, /=, etc. require an existing variable
semsg(_(e_cannot_use_operator_on_new_variable), eap->arg); semsg(_(e_cannot_use_operator_on_new_variable), eap->arg);
i = FAIL;
} }
else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL) else if (vim_strchr((char_u *)"+-*/%.", *expr) != NULL)
{ {
@ -1112,7 +1111,6 @@ ex_let(exarg_T *eap)
vim_strncpy(op, expr - len, len); vim_strncpy(op, expr - len, len);
semsg(_(e_white_space_required_before_and_after_str_at_str), semsg(_(e_white_space_required_before_and_after_str_at_str),
op, argend); op, argend);
i = FAIL;
} }
if (eap->skip) if (eap->skip)

View File

@ -54,12 +54,11 @@ string2float(
if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL) if (skip_quotes && vim_strchr((char_u *)s, '\'') != NULL)
{ {
char_u buf[100]; char_u buf[100];
char_u *p = buf; char_u *p;
int quotes = 0; int quotes = 0;
vim_strncpy(buf, (char_u *)s, 99); vim_strncpy(buf, (char_u *)s, 99);
p = buf; for (p = buf; ; p = skipdigits(p))
for (;;)
{ {
// remove single quotes between digits, not in the exponent // remove single quotes between digits, not in the exponent
if (*p == '\'') if (*p == '\'')
@ -69,7 +68,6 @@ string2float(
} }
if (!vim_isdigit(*p)) if (!vim_isdigit(*p))
break; break;
p = skipdigits(p);
} }
s = (char *)buf; s = (char *)buf;
f = strtod(s, &s); f = strtod(s, &s);

View File

@ -4515,7 +4515,7 @@ hlg_add_or_update(dict_T *dict)
# endif # endif
p = add_attr_and_value(p, (char_u *)" guifg=", 7, guifg); p = add_attr_and_value(p, (char_u *)" guifg=", 7, guifg);
p = add_attr_and_value(p, (char_u *)" guibg=", 7, guibg); p = add_attr_and_value(p, (char_u *)" guibg=", 7, guibg);
p = add_attr_and_value(p, (char_u *)" guisp=", 7, guisp); (void)add_attr_and_value(p, (char_u *)" guisp=", 7, guisp);
do_highlight(hlsetBuf, forceit, FALSE); do_highlight(hlsetBuf, forceit, FALSE);

View File

@ -5617,7 +5617,6 @@ f_setcellwidths(typval_T *argvars, typval_T *rettv UNUSED)
} }
// Store the items in the new table. // Store the items in the new table.
item = 0;
for (item = 0; item < l->lv_len; ++item) for (item = 0; item < l->lv_len; ++item)
{ {
listitem_T *lili = ptrs[item]; listitem_T *lili = ptrs[item];

View File

@ -1282,11 +1282,11 @@ op_tilde(oparg_T *oap)
#ifdef FEAT_NETBEANS_INTG #ifdef FEAT_NETBEANS_INTG
if (netbeans_active() && one_change) if (netbeans_active() && one_change)
{ {
char_u *ptr = ml_get_buf(curbuf, pos.lnum, FALSE); char_u *ptr;
netbeans_removed(curbuf, pos.lnum, bd.textcol, netbeans_removed(curbuf, pos.lnum, bd.textcol,
(long)bd.textlen); (long)bd.textlen);
// get the line again, it may have been flushed // get the line now, it may have been flushed
ptr = ml_get_buf(curbuf, pos.lnum, FALSE); ptr = ml_get_buf(curbuf, pos.lnum, FALSE);
netbeans_inserted(curbuf, pos.lnum, bd.textcol, netbeans_inserted(curbuf, pos.lnum, bd.textcol,
&ptr[bd.textcol], bd.textlen); &ptr[bd.textcol], bd.textlen);

View File

@ -4368,7 +4368,12 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
{ {
for (i = 0; i < num_matches; ++i) for (i = 0; i < num_matches; ++i)
{ {
parse_match(matches[i], &tp); if (parse_match(matches[i], &tp) == FAIL)
{
vim_free(matches[i]);
continue;
}
is_static = test_for_static(&tp); is_static = test_for_static(&tp);
// Skip pseudo-tag lines. // Skip pseudo-tag lines.

View File

@ -707,6 +707,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
364,
/**/ /**/
363, 363,
/**/ /**/

View File

@ -2243,9 +2243,9 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
r = compile_expr0_ext(&p, cctx, &is_const); r = compile_expr0_ext(&p, cctx, &is_const);
if (lhs.lhs_new_local) if (lhs.lhs_new_local)
++cctx->ctx_locals.ga_len; ++cctx->ctx_locals.ga_len;
if (r == FAIL)
goto theend;
} }
if (r == FAIL)
goto theend;
} }
else if (semicolon && var_idx == var_count - 1) else if (semicolon && var_idx == var_count - 1)
{ {