Skip to content

Commit

Permalink
PVS/V1037: suppress warning neovim#10526
Browse files Browse the repository at this point in the history
* Case branches are semantically different.
* Lint
  • Loading branch information
ngortheone authored and justinmk committed Jul 18, 2019
1 parent 3d356c1 commit 9412dcb
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/nvim/regexp_nfa.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,8 +1263,8 @@ static int nfa_regatom(void)
IEMSGN("INTERNAL: Unknown character class char: %" PRId64, c);
return FAIL;
}
/* When '.' is followed by a composing char ignore the dot, so that
* the composing char is matched here. */
// When '.' is followed by a composing char ignore the dot, so that
// the composing char is matched here.
if (enc_utf8 && c == Magic('.') && utf_iscomposing(peekchr())) {
old_regparse = regparse;
c = getchr();
Expand All @@ -1279,25 +1279,26 @@ static int nfa_regatom(void)
break;

case Magic('n'):
if (reg_string)
/* In a string "\n" matches a newline character. */
if (reg_string) {
// In a string "\n" matches a newline character.
EMIT(NL);
else {
/* In buffer text "\n" matches the end of a line. */
} else {
// In buffer text "\n" matches the end of a line.
EMIT(NFA_NEWL);
regflags |= RF_HASNL;
}
break;

case Magic('('):
if (nfa_reg(REG_PAREN) == FAIL)
return FAIL; /* cascaded error */
if (nfa_reg(REG_PAREN) == FAIL) {
return FAIL; // cascaded error
}
break;

case Magic('|'):
case Magic('&'):
case Magic(')'):
EMSGN(_(e_misplaced), no_Magic(c));
EMSGN(_(e_misplaced), no_Magic(c)); // -V1037
return FAIL;

case Magic('='):
Expand All @@ -1306,16 +1307,16 @@ static int nfa_regatom(void)
case Magic('@'):
case Magic('*'):
case Magic('{'):
/* these should follow an atom, not form an atom */
// these should follow an atom, not form an atom
EMSGN(_(e_misplaced), no_Magic(c));
return FAIL;

case Magic('~'):
{
char_u *lp;

/* Previous substitute pattern.
* Generated as "\%(pattern\)". */
// Previous substitute pattern.
// Generated as "\%(pattern\)".
if (reg_prev_sub == NULL) {
EMSG(_(e_nopresub));
return FAIL;
Expand Down

0 comments on commit 9412dcb

Please sign in to comment.