diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile | 6 | ||||
-rw-r--r-- | src/blowfish.c | 2 | ||||
-rw-r--r-- | src/dict.c | 2 | ||||
-rw-r--r-- | src/edit.c | 4 | ||||
-rw-r--r-- | src/eval.c | 18 | ||||
-rw-r--r-- | src/evalfunc.c | 4 | ||||
-rw-r--r-- | src/ex_eval.c | 8 | ||||
-rw-r--r-- | src/getchar.c | 8 | ||||
-rw-r--r-- | src/globals.h | 2 | ||||
-rw-r--r-- | src/gui_beval.c | 2 | ||||
-rw-r--r-- | src/gui_w32.c | 2 | ||||
-rw-r--r-- | src/hangulin.c | 2 | ||||
-rw-r--r-- | src/hashtab.c | 2 | ||||
-rw-r--r-- | src/if_cscope.c | 2 | ||||
-rw-r--r-- | src/json.c | 2 | ||||
-rw-r--r-- | src/memfile.c | 2 | ||||
-rw-r--r-- | src/memline.c | 28 | ||||
-rw-r--r-- | src/message.c | 79 | ||||
-rw-r--r-- | src/misc2.c | 30 | ||||
-rw-r--r-- | src/option.c | 8 | ||||
-rw-r--r-- | src/proto/message.pro | 6 | ||||
-rw-r--r-- | src/proto/misc2.pro | 2 | ||||
-rw-r--r-- | src/quickfix.c | 2 | ||||
-rw-r--r-- | src/regexp.c | 6 | ||||
-rw-r--r-- | src/spell.c | 2 | ||||
-rw-r--r-- | src/undo.c | 8 | ||||
-rw-r--r-- | src/userfunc.c | 4 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 3 | ||||
-rw-r--r-- | src/window.c | 2 |
30 files changed, 159 insertions, 91 deletions
diff --git a/src/Makefile b/src/Makefile index fd07946ba..fef53af43 100644 --- a/src/Makefile +++ b/src/Makefile @@ -681,6 +681,10 @@ SANITIZER_LIBS = $(SANITIZER_CFLAGS) #LEAK_CFLAGS = -DEXITFREE #LEAK_LIBS = -lccmalloc +# Uncomment this line to have Vim call abort() when an internal error is +# detected. Useful when using a tool to find errors. +#ABORT_CLFAGS = -DABORT_ON_INTERNAL_ERROR + ##################################################### ### Specific systems, check if yours is listed! ### {{{ ##################################################### @@ -1409,7 +1413,7 @@ SHELL = /bin/sh PRE_DEFS = -Iproto $(DEFS) $(GUI_DEFS) $(GUI_IPATH) $(CPPFLAGS) $(EXTRA_IPATHS) POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(EXTRA_DEFS) -ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(SANITIZER_CFLAGS) $(LEAK_CFLAGS) $(POST_DEFS) +ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(SANITIZER_CFLAGS) $(LEAK_CFLAGS) $(ABORT_CLFAGS) $(POST_DEFS) # Exclude $CFLAGS for osdef.sh, for Mac 10.4 some flags don't work together # with "-E". diff --git a/src/blowfish.c b/src/blowfish.c index d3f5cff2c..ac9b088d6 100644 --- a/src/blowfish.c +++ b/src/blowfish.c @@ -426,7 +426,7 @@ bf_key_init( keylen = (int)STRLEN(key) / 2; if (keylen == 0) { - EMSG(_("E831: bf_key_init() called with empty password")); + IEMSG(_("E831: bf_key_init() called with empty password")); return; } for (i = 0; i < keylen; i++) diff --git a/src/dict.c b/src/dict.c index 136348bd4..07d10008c 100644 --- a/src/dict.c +++ b/src/dict.c @@ -214,7 +214,7 @@ dictitem_remove(dict_T *dict, dictitem_T *item) hi = hash_find(&dict->dv_hashtab, item->di_key); if (HASHITEM_EMPTY(hi)) - EMSG2(_(e_intern2), "dictitem_remove()"); + internal_error("dictitem_remove()"); else hash_remove(&dict->dv_hashtab, hi); dictitem_free(item); diff --git a/src/edit.c b/src/edit.c index 3a0e18841..0d9e9d4a4 100644 --- a/src/edit.c +++ b/src/edit.c @@ -2299,7 +2299,7 @@ vim_is_ctrl_x_key(int c) case CTRL_X_EVAL: return (c == Ctrl_P || c == Ctrl_N); } - EMSG(_(e_internal)); + internal_error("vim_is_ctrl_x_key()"); return FALSE; } @@ -5431,7 +5431,7 @@ ins_complete(int c, int enable_pum) } else { - EMSG2(_(e_intern2), "ins_complete()"); + internal_error("ins_complete()"); return FAIL; } diff --git a/src/eval.c b/src/eval.c index 18eb87936..e92a97f18 100644 --- a/src/eval.c +++ b/src/eval.c @@ -839,7 +839,7 @@ restore_vimvar(int idx, typval_T *save_tv) { hi = hash_find(&vimvarht, vimvars[idx].vv_di.di_key); if (HASHITEM_EMPTY(hi)) - EMSG2(_(e_intern2), "restore_vimvar()"); + internal_error("restore_vimvar()"); else hash_remove(&vimvarht, hi); } @@ -1308,7 +1308,7 @@ ex_let_vars( } else if (*arg != ',' && *arg != ']') { - EMSG2(_(e_intern2), "ex_let_vars()"); + internal_error("ex_let_vars()"); return FAIL; } } @@ -2830,7 +2830,7 @@ do_unlet(char_u *name, int forceit) } if (d == NULL) { - EMSG2(_(e_intern2), "do_unlet()"); + internal_error("do_unlet()"); return FAIL; } } @@ -5678,7 +5678,7 @@ get_var_special_name(int nr) case VVAL_NONE: return "v:none"; case VVAL_NULL: return "v:null"; } - EMSG2(_(e_intern2), "get_var_special_name()"); + internal_error("get_var_special_name()"); return "42"; } @@ -7152,7 +7152,7 @@ get_tv_number_chk(typval_T *varp, int *denote) break; #endif case VAR_UNKNOWN: - EMSG2(_(e_intern2), "get_tv_number(UNKNOWN)"); + internal_error("get_tv_number(UNKNOWN)"); break; } if (denote == NULL) /* useful for values that must be unsigned */ @@ -7199,7 +7199,7 @@ get_tv_float(typval_T *varp) break; # endif case VAR_UNKNOWN: - EMSG2(_(e_intern2), "get_tv_float(UNKNOWN)"); + internal_error("get_tv_float(UNKNOWN)"); break; } return 0; @@ -7733,7 +7733,7 @@ set_var( return; } else if (v->di_tv.v_type != tv->v_type) - EMSG2(_(e_intern2), "set_var()"); + internal_error("set_var()"); } clear_tv(&v->di_tv); @@ -7962,7 +7962,7 @@ copy_tv(typval_T *from, typval_T *to) } break; case VAR_UNKNOWN: - EMSG2(_(e_intern2), "copy_tv(UNKNOWN)"); + internal_error("copy_tv(UNKNOWN)"); break; } } @@ -8036,7 +8036,7 @@ item_copy( ret = FAIL; break; case VAR_UNKNOWN: - EMSG2(_(e_intern2), "item_copy(UNKNOWN)"); + internal_error("item_copy(UNKNOWN)"); ret = FAIL; } --recurse; diff --git a/src/evalfunc.c b/src/evalfunc.c index f643329c9..1257aa059 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -2644,7 +2644,7 @@ f_empty(typval_T *argvars, typval_T *rettv) break; #endif case VAR_UNKNOWN: - EMSG2(_(e_intern2), "f_empty(UNKNOWN)"); + internal_error("f_empty(UNKNOWN)"); n = TRUE; break; } @@ -12695,7 +12695,7 @@ f_type(typval_T *argvars, typval_T *rettv) case VAR_JOB: n = VAR_TYPE_JOB; break; case VAR_CHANNEL: n = VAR_TYPE_CHANNEL; break; case VAR_UNKNOWN: - EMSG2(_(e_intern2), "f_type(UNKNOWN)"); + internal_error("f_type(UNKNOWN)"); n = -1; break; } diff --git a/src/ex_eval.c b/src/ex_eval.c index daccfc868..7589f8e0d 100644 --- a/src/ex_eval.c +++ b/src/ex_eval.c @@ -595,7 +595,7 @@ discard_exception(except_T *excp, int was_finished) if (excp == NULL) { - EMSG(_(e_internal)); + internal_error("discard_exception()"); return; } @@ -700,7 +700,7 @@ catch_exception(except_T *excp) finish_exception(except_T *excp) { if (excp != caught_stack) - EMSG(_(e_internal)); + internal_error("finish_exception()"); caught_stack = caught_stack->caught; if (caught_stack != NULL) { @@ -1603,7 +1603,7 @@ ex_catch(exarg_T *eap) * ":break", ":return", ":finish", error, interrupt, or another * exception. */ if (cstack->cs_exception[cstack->cs_idx] != current_exception) - EMSG(_(e_internal)); + internal_error("ex_catch()"); } else { @@ -1737,7 +1737,7 @@ ex_finally(exarg_T *eap) * exception will be discarded. */ if (did_throw && cstack->cs_exception[cstack->cs_idx] != current_exception) - EMSG(_(e_internal)); + internal_error("ex_finally()"); } /* diff --git a/src/getchar.c b/src/getchar.c index 55db53767..3657433a5 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -250,7 +250,7 @@ add_buff( } else if (buf->bh_curr == NULL) /* buffer has already been read */ { - EMSG(_("E222: Add to read buffer")); + IEMSG(_("E222: Add to read buffer")); return; } else if (buf->bh_index != 0) @@ -1321,11 +1321,11 @@ alloc_typebuf(void) free_typebuf(void) { if (typebuf.tb_buf == typebuf_init) - EMSG2(_(e_intern2), "Free typebuf 1"); + internal_error("Free typebuf 1"); else vim_free(typebuf.tb_buf); if (typebuf.tb_noremap == noremapbuf_init) - EMSG2(_(e_intern2), "Free typebuf 2"); + internal_error("Free typebuf 2"); else vim_free(typebuf.tb_noremap); } @@ -4868,7 +4868,7 @@ makemap( c1 = 'l'; break; default: - EMSG(_("E228: makemap: Illegal mode")); + IEMSG(_("E228: makemap: Illegal mode")); return FAIL; } do /* do this twice if c2 is set, 3 times with c3 */ diff --git a/src/globals.h b/src/globals.h index fea9543a7..c15e4f9bb 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1440,6 +1440,7 @@ EXTERN char_u e_font[] INIT(= N_("E235: Unknown font: %s")); EXTERN char_u e_fontwidth[] INIT(= N_("E236: Font \"%s\" is not fixed-width")); #endif EXTERN char_u e_internal[] INIT(= N_("E473: Internal error")); +EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s")); EXTERN char_u e_interr[] INIT(= N_("Interrupted")); EXTERN char_u e_invaddr[] INIT(= N_("E14: Invalid address")); EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument")); @@ -1589,7 +1590,6 @@ EXTERN char_u e_invexprmsg[] INIT(= N_("E449: Invalid expression received")); EXTERN char_u e_guarded[] INIT(= N_("E463: Region is guarded, cannot modify")); EXTERN char_u e_nbreadonly[] INIT(= N_("E744: NetBeans does not allow changes in read-only files")); #endif -EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s")); EXTERN char_u e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'")); EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer")); EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %ld does not exist")); diff --git a/src/gui_beval.c b/src/gui_beval.c index 4a7c06ed9..8569f6012 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -218,7 +218,7 @@ gui_mch_create_beval_area( if (mesg != NULL && mesgCB != NULL) { - EMSG(_("E232: Cannot create BalloonEval with both message and callback")); + IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } diff --git a/src/gui_w32.c b/src/gui_w32.c index be2158dc6..02c5ed16a 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -8620,7 +8620,7 @@ gui_mch_create_beval_area( if (mesg != NULL && mesgCB != NULL) { - EMSG(_("E232: Cannot create BalloonEval with both message and callback")); + IEMSG(_("E232: Cannot create BalloonEval with both message and callback")); return NULL; } diff --git a/src/hangulin.c b/src/hangulin.c index 1b5604be7..60b3577ff 100644 --- a/src/hangulin.c +++ b/src/hangulin.c @@ -590,7 +590,7 @@ hangul_automata2(char_u *buf, int_u *c) return AUTOMATA_CORRECT_NEW; default: - EMSG(_("E256: Hangul automata ERROR")); + IEMSG(_("E256: Hangul automata ERROR")); break; } return AUTOMATA_ERROR; /* RrEeAaLlLlYy EeRrRrOoRr */ diff --git a/src/hashtab.c b/src/hashtab.c index d8d3aed28..658bfb969 100644 --- a/src/hashtab.c +++ b/src/hashtab.c @@ -210,7 +210,7 @@ hash_add(hashtab_T *ht, char_u *key) hi = hash_lookup(ht, key, hash); if (!HASHITEM_EMPTY(hi)) { - EMSG2(_(e_intern2), "hash_add()"); + internal_error("hash_add()"); return FAIL; } return hash_add_item(ht, hi, key, hash); diff --git a/src/if_cscope.c b/src/if_cscope.c index 9e7a362b2..ce6b87f37 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -1792,7 +1792,7 @@ cs_manage_matches( cs_print_tags_priv(mp, cp, cnt); break; default: /* should not reach here */ - (void)EMSG(_("E570: fatal error in cs_manage_matches")); + IEMSG(_("E570: fatal error in cs_manage_matches")); return NULL; } diff --git a/src/json.c b/src/json.c index 36d47aa99..4ec4411fb 100644 --- a/src/json.c +++ b/src/json.c @@ -328,7 +328,7 @@ json_encode_item(garray_T *gap, typval_T *val, int copyID, int options) break; #endif case VAR_UNKNOWN: - EMSG2(_(e_intern2), "json_encode_item()"); + internal_error("json_encode_item()"); return FAIL; } return OK; diff --git a/src/memfile.c b/src/memfile.c index 2f7520196..0fb27871b 100644 --- a/src/memfile.c +++ b/src/memfile.c @@ -482,7 +482,7 @@ mf_put( flags = hp->bh_flags; if ((flags & BH_LOCKED) == 0) - EMSG(_("E293: block was not locked")); + IEMSG(_("E293: block was not locked")); flags &= ~BH_LOCKED; if (dirty) { diff --git a/src/memline.c b/src/memline.c index 37555e6e5..e3a4bdbc6 100644 --- a/src/memline.c +++ b/src/memline.c @@ -333,7 +333,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 0) { - EMSG(_("E298: Didn't get block nr 0?")); + IEMSG(_("E298: Didn't get block nr 0?")); goto error; } b0p = (ZERO_BL *)(hp->bh_data); @@ -383,7 +383,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 1) { - EMSG(_("E298: Didn't get block nr 1?")); + IEMSG(_("E298: Didn't get block nr 1?")); goto error; } pp = (PTR_BL *)(hp->bh_data); @@ -401,7 +401,7 @@ ml_open(buf_T *buf) goto error; if (hp->bh_bnum != 2) { - EMSG(_("E298: Didn't get block nr 2?")); + IEMSG(_("E298: Didn't get block nr 2?")); goto error; } @@ -950,7 +950,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T what) b0p = (ZERO_BL *)(hp->bh_data); if (ml_check_b0_id(b0p) == FAIL) - EMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); + IEMSG(_("E304: ml_upd_block0(): Didn't get block 0??")); else { if (what == UB_FNAME) @@ -2450,7 +2450,7 @@ ml_get_buf( /* Avoid giving this message for a recursive call, may happen when * the GUI redraws part of the text. */ ++recursive; - EMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum); + IEMSGN(_("E315: ml_get: invalid lnum: %ld"), lnum); --recursive; } errorret: @@ -2485,7 +2485,7 @@ errorret: /* Avoid giving this message for a recursive call, may happen * when the GUI redraws part of the text. */ ++recursive; - EMSGN(_("E316: ml_get: cannot find line %ld"), lnum); + IEMSGN(_("E316: ml_get: cannot find line %ld"), lnum); --recursive; } goto errorret; @@ -2900,7 +2900,7 @@ ml_append_int( pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong 3")); + IEMSG(_("E317: pointer block id wrong 3")); mf_put(mfp, hp, FALSE, FALSE); return FAIL; } @@ -3042,7 +3042,7 @@ ml_append_int( */ if (stack_idx < 0) { - EMSG(_("E318: Updated too many blocks?")); + IEMSG(_("E318: Updated too many blocks?")); buf->b_ml.ml_stack_top = 0; /* invalidate stack */ } } @@ -3220,7 +3220,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum, int message) pp = (PTR_BL *)(hp->bh_data); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong 4")); + IEMSG(_("E317: pointer block id wrong 4")); mf_put(mfp, hp, FALSE, FALSE); return FAIL; } @@ -3432,7 +3432,7 @@ ml_flush_line(buf_T *buf) hp = ml_find_line(buf, lnum, ML_FIND); if (hp == NULL) - EMSGN(_("E320: Cannot find line %ld"), lnum); + IEMSGN(_("E320: Cannot find line %ld"), lnum); else { dp = (DATA_BL *)(hp->bh_data); @@ -3674,7 +3674,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action) pp = (PTR_BL *)(dp); /* must be pointer block */ if (pp->pb_id != PTR_ID) { - EMSG(_("E317: pointer block id wrong")); + IEMSG(_("E317: pointer block id wrong")); goto error_block; } @@ -3719,11 +3719,11 @@ ml_find_line(buf_T *buf, linenr_T lnum, int action) if (idx >= (int)pp->pb_count) /* past the end: something wrong! */ { if (lnum > buf->b_ml.ml_line_count) - EMSGN(_("E322: line number out of range: %ld past the end"), + IEMSGN(_("E322: line number out of range: %ld past the end"), lnum - buf->b_ml.ml_line_count); else - EMSGN(_("E323: line count wrong in block %ld"), bnum); + IEMSGN(_("E323: line count wrong in block %ld"), bnum); goto error_block; } if (action == ML_DELETE) @@ -3817,7 +3817,7 @@ ml_lineadd(buf_T *buf, int count) if (pp->pb_id != PTR_ID) { mf_put(mfp, hp, FALSE, FALSE); - EMSG(_("E317: pointer block id wrong 2")); + IEMSG(_("E317: pointer block id wrong 2")); break; } pp->pb_pointer[ip->ip_index].pe_line_count += count; diff --git a/src/message.c b/src/message.c index f8152a7b5..32360a93b 100644 --- a/src/message.c +++ b/src/message.c @@ -662,6 +662,7 @@ emsg(char_u *s) return msg_attr(s, attr); } + /* * Print an error message with one "%s" and one string argument. */ @@ -671,6 +672,84 @@ emsg2(char_u *s, char_u *a1) return emsg3(s, a1, NULL); } +/* + * Print an error message with one or two "%s" and one or two string arguments. + * This is not in message.c to avoid a warning for prototypes. + */ + int +emsg3(char_u *s, char_u *a1, char_u *a2) +{ + if (emsg_not_now()) + return TRUE; /* no error messages at the moment */ + vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); + return emsg(IObuff); +} + +/* + * Print an error message with one "%ld" and one long int argument. + * This is not in message.c to avoid a warning for prototypes. + */ + int +emsgn(char_u *s, long n) +{ + if (emsg_not_now()) + return TRUE; /* no error messages at the moment */ + vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); + return emsg(IObuff); +} + +/* + * Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsg(char_u *s) +{ + msg(s); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + + +/* + * Same as emsg2(...) but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsg2(char_u *s, char_u *a1) +{ + emsg2(s, a1); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + +/* + * Same as emsgn(...) but abort on error when ABORT_ON_INTERNAL_ERROR is + * defined. It is used for internal errors only, so that they can be + * detected when fuzzing vim. + */ + void +iemsgn(char_u *s, long n) +{ + emsgn(s, n); +#ifdef ABORT_ON_INTERNAL_ERROR + abort(); +#endif +} + +/* + * Give an "Internal error" message. + */ + void +internal_error(char *where) +{ + IEMSG2(_(e_intern2), where); +} + /* emsg3() and emsgn() are in misc2.c to avoid warnings for the prototypes. */ void diff --git a/src/misc2.c b/src/misc2.c index 3803249de..27d26bece 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -918,7 +918,7 @@ lalloc(long_u size, int message) { /* Don't hide this message */ emsg_silent = 0; - EMSGN(_("E341: Internal error: lalloc(%ld, )"), size); + IEMSGN(_("E341: Internal error: lalloc(%ld, )"), size); return NULL; } @@ -1075,7 +1075,7 @@ free_all_mem(void) p_ea = FALSE; if (first_tabpage->tp_next != NULL) do_cmdline_cmd((char_u *)"tabonly!"); - if (firstwin != lastwin) + if (!ONE_WINDOW) do_cmdline_cmd((char_u *)"only!"); # endif @@ -6040,32 +6040,6 @@ filewritable(char_u *fname) } #endif -/* - * Print an error message with one or two "%s" and one or two string arguments. - * This is not in message.c to avoid a warning for prototypes. - */ - int -emsg3(char_u *s, char_u *a1, char_u *a2) -{ - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, a1, a2); - return emsg(IObuff); -} - -/* - * Print an error message with one "%ld" and one long int argument. - * This is not in message.c to avoid a warning for prototypes. - */ - int -emsgn(char_u *s, long n) -{ - if (emsg_not_now()) - return TRUE; /* no error messages at the moment */ - vim_snprintf((char *)IObuff, IOSIZE, (char *)s, n); - return emsg(IObuff); -} - #if defined(FEAT_SPELL) || defined(FEAT_PERSISTENT_UNDO) || defined(PROTO) /* * Read 2 bytes from "fd" and turn them into an int, MSB first. diff --git a/src/option.c b/src/option.c index ecfdc40dc..2b9ba2dcf 100644 --- a/src/option.c +++ b/src/option.c @@ -5615,7 +5615,7 @@ was_set_insecurely(char_u *opt, int opt_flags) flagp = insecure_flag(idx, opt_flags); return (*flagp & P_INSECURE) != 0; } - EMSG2(_(e_intern2), "was_set_insecurely()"); + internal_error("was_set_insecurely()"); return -1; } @@ -5696,7 +5696,7 @@ set_string_option_direct( if (idx < 0) /* not found (should not happen) */ { EMSG2(_(e_intern2), "set_string_option_direct()"); - EMSG2(_("For option %s"), name); + IEMSG2(_("For option %s"), name); return; } } @@ -9375,7 +9375,7 @@ option_iter_next(void **option, int opt_type) ret = NULL; break; default: - EMSG2(_(e_intern2), "option_iter_next()"); + internal_error("option_iter_next()"); return NULL; } } @@ -10496,7 +10496,7 @@ get_varp(struct vimoption *p) #ifdef FEAT_SIGNS case PV_SCL: return (char_u *)&(curwin->w_p_scl); #endif - default: EMSG(_("E356: get_varp ERROR")); + default: IEMSG(_("E356: get_varp ERROR")); } /* always return a valid pointer to avoid a crash! */ return (char_u *)&(curbuf->b_p_wm); diff --git a/src/proto/message.pro b/src/proto/message.pro index 7112b0923..c9d62c66e 100644 --- a/src/proto/message.pro +++ b/src/proto/message.pro @@ -11,6 +11,12 @@ int emsg_not_now(void); void do_perror(char *msg); int emsg(char_u *s); int emsg2(char_u *s, char_u *a1); +int emsg3(char_u *s, char_u *a1, char_u *a2); +int emsgn(char_u *s, long n); +void iemsg(char_u *s); +void iemsg2(char_u *s, char_u *a1); +void iemsgn(char_u *s, long n); +void internal_error(char *where); void emsg_invreg(int name); char_u *msg_trunc_attr(char_u *s, int force, int attr); char_u *msg_may_trunc(int force, char_u *s); diff --git a/src/proto/misc2.pro b/src/proto/misc2.pro index d18ae2033..144324f6e 100644 --- a/src/proto/misc2.pro +++ b/src/proto/misc2.pro @@ -99,8 +99,6 @@ int get_user_name(char_u *buf, int len); void sort_strings(char_u **files, int count); int pathcmp(const char *p, const char *q, int maxlen); int filewritable(char_u *fname); -int emsg3(char_u *s, char_u *a1, char_u *a2); -int emsgn(char_u *s, long n); int get2c(FILE *fd); int get3c(FILE *fd); int get4c(FILE *fd); diff --git a/src/quickfix.c b/src/quickfix.c index a45faeaa9..a563fa946 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3231,7 +3231,7 @@ qf_fill_buffer(qf_info_T *qi, buf_T *buf, qfline_T *old_last) { if (buf != curbuf) { - EMSG2(_(e_intern2), "qf_fill_buffer()"); + internal_error("qf_fill_buffer()"); return; } diff --git a/src/regexp.c b/src/regexp.c index 8d63d5a26..78d643174 100644 --- a/src/regexp.c +++ b/src/regexp.c @@ -335,11 +335,13 @@ 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, (void *)NULL) #define EMSG2_RET_FAIL(m, c) return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = TRUE, FAIL) #define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL) + #define MAX_LIMIT (32767L << 16L) static int re_multi_type(int); @@ -2043,7 +2045,7 @@ regatom(int *flagp) case Magic(')'): if (one_exactly) EMSG_ONE_RET_NULL; - EMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */ + IEMSG_RET_NULL(_(e_internal)); /* Supposed to be caught earlier. */ /* NOTREACHED */ case Magic('='): @@ -5070,7 +5072,7 @@ regmatch( } else { - EMSG(_(e_internal)); /* Shouldn't happen */ + internal_error("BRACE_LIMITS"); status = RA_FAIL; } } diff --git a/src/spell.c b/src/spell.c index eb81ad27b..91a48fa77 100644 --- a/src/spell.c +++ b/src/spell.c @@ -6428,7 +6428,7 @@ add_sound_suggest( sfwordnr = soundfold_find(slang, goodword); if (sfwordnr < 0) { - EMSG2(_(e_intern2), "add_sound_suggest()"); + internal_error("add_sound_suggest()"); return; } diff --git a/src/undo.c b/src/undo.c index cc74edd94..57c3c2021 100644 --- a/src/undo.c +++ b/src/undo.c @@ -2582,7 +2582,7 @@ undo_time( if (uhp == NULL || uhp->uh_walk != mark) { /* Need to redo more but can't find it... */ - EMSG2(_(e_intern2), "undo_time()"); + internal_error("undo_time()"); break; } } @@ -2654,7 +2654,7 @@ u_undoredo(int undo) #ifdef FEAT_AUTOCMD unblock_autocmds(); #endif - EMSG(_("E438: u_undo: line numbers wrong")); + IEMSG(_("E438: u_undo: line numbers wrong")); changed(); /* don't want UNCHANGED now */ return; } @@ -3234,7 +3234,7 @@ u_get_headentry(void) { if (curbuf->b_u_newhead == NULL || curbuf->b_u_newhead->uh_entry == NULL) { - EMSG(_("E439: undo list corrupt")); + IEMSG(_("E439: undo list corrupt")); return NULL; } return curbuf->b_u_newhead->uh_entry; @@ -3266,7 +3266,7 @@ u_getbot(void) uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra; if (uep->ue_bot < 1 || uep->ue_bot > curbuf->b_ml.ml_line_count) { - EMSG(_("E440: undo line missing")); + IEMSG(_("E440: undo line missing")); uep->ue_bot = uep->ue_top + 1; /* assume all lines deleted, will * get all the old lines back * without deleting the current diff --git a/src/userfunc.c b/src/userfunc.c index c75ccbc32..369d92ad6 100644 --- a/src/userfunc.c +++ b/src/userfunc.c @@ -2771,7 +2771,7 @@ func_unref(char_u *name) #ifdef EXITFREE if (!entered_free_all_mem) #endif - EMSG2(_(e_intern2), "func_unref()"); + internal_error("func_unref()"); } if (fp != NULL && --fp->uf_refcount <= 0) { @@ -2814,7 +2814,7 @@ func_ref(char_u *name) else if (isdigit(*name)) /* Only give an error for a numbered function. * Fail silently, when named or lambda function isn't found. */ - EMSG2(_(e_intern2), "func_ref()"); + internal_error("func_ref()"); } /* diff --git a/src/version.c b/src/version.c index 6d125005c..80e30dcc6 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 74, +/**/ 73, /**/ 72, @@ -1623,6 +1623,9 @@ typedef UINT32_TYPEDEF UINT32_T; #define EMSG3(s, p, q) emsg3((char_u *)(s), (char_u *)(p), (char_u *)(q)) #define EMSGN(s, n) emsgn((char_u *)(s), (long)(n)) #define EMSGU(s, n) emsgu((char_u *)(s), (long_u)(n)) +#define IEMSG(s) iemsg((char_u *)(s)) +#define IEMSG2(s, p) iemsg2((char_u *)(s), (char_u *)(p)) +#define IEMSGN(s, n) iemsgn((char_u *)(s), (long)(n)) #define OUT_STR(s) out_str((char_u *)(s)) #define OUT_STR_NF(s) out_str_nf((char_u *)(s)) #define MSG_PUTS(s) msg_puts((char_u *)(s)) diff --git a/src/window.c b/src/window.c index c4448b77e..8e5336883 100644 --- a/src/window.c +++ b/src/window.c @@ -2538,7 +2538,7 @@ win_close_othertab(win_T *win, int free_buf, tabpage_T *tp) ; if (ptp == NULL) { - EMSG2(_(e_intern2), "win_close_othertab()"); + internal_error("win_close_othertab()"); return; } ptp->tp_next = tp->tp_next; |