vim-patch:8.0.0074

Problem:    Cannot make Vim fail on an internal error.
Solution:   Add IEMSG() and IEMSG2(). (Domenique Pelle)  Avoid reporting an
            internal error without mentioning where.

95f096030e

Signed-off-by: Michael Schupikov <michael@schupikov.de>
This commit is contained in:
Michael Schupikov
2017-09-23 09:56:44 +02:00
committed by James McCoy
parent 6ff13d78b7
commit d5bce42b52
20 changed files with 144 additions and 85 deletions

View File

@@ -459,14 +459,15 @@ static int toggle_Magic(int x)
/* Used for an error (down from) vim_regcomp(): give the error message, set
* rc_did_emsg and return NULL */
#define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = TRUE, (void *)NULL)
#define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = true, (void *)NULL)
#define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = TRUE, FAIL)
#define EMSG2_RET_NULL(m, \
c) return (EMSG2((m), \
(c) ? "" : "\\"), rc_did_emsg = TRUE, \
(c) ? "" : "\\"), rc_did_emsg = true, \
(void *)NULL)
#define EMSG2_RET_FAIL(m, \
c) return (EMSG2((m), \
(c) ? "" : "\\"), rc_did_emsg = TRUE, \
(c) ? "" : "\\"), rc_did_emsg = true, \
FAIL)
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_( \
"E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
@@ -1891,8 +1892,8 @@ static char_u *regatom(int *flagp)
case Magic(')'):
if (one_exactly)
EMSG_ONE_RET_NULL;
EMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */
/* NOTREACHED */
IEMSG_RET_NULL(_(e_internal)); // Supposed to be caught earlier.
// NOTREACHED
case Magic('='):
case Magic('?'):
@@ -4534,7 +4535,7 @@ regmatch (
brace_max[no] = OPERAND_MAX(scan);
brace_count[no] = 0;
} else {
EMSG(_(e_internal)); /* Shouldn't happen */
internal_error("BRACE_LIMITS");
status = RA_FAIL;
}
}