]> granicus.if.org Git - vim/commitdiff
patch 8.0.0074 v8.0.0074
authorBram Moolenaar <Bram@vim.org>
Thu, 10 Nov 2016 19:01:45 +0000 (20:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 10 Nov 2016 19:01:45 +0000 (20:01 +0100)
Problem:    Cannot make Vim fail on an internal error.
Solution:   Add IEMSG() and IEMSG2(). (Domenique Pelle)  Avoid reporting an
            internal error without mentioning where.

30 files changed:
src/Makefile
src/blowfish.c
src/dict.c
src/edit.c
src/eval.c
src/evalfunc.c
src/ex_eval.c
src/getchar.c
src/globals.h
src/gui_beval.c
src/gui_w32.c
src/hangulin.c
src/hashtab.c
src/if_cscope.c
src/json.c
src/memfile.c
src/memline.c
src/message.c
src/misc2.c
src/option.c
src/proto/message.pro
src/proto/misc2.pro
src/quickfix.c
src/regexp.c
src/spell.c
src/undo.c
src/userfunc.c
src/version.c
src/vim.h
src/window.c

index fd07946baa151559f02defdc681036f6374d879b..fef53af43282fe6283aaf2adfda6fbe9f143f09d 100644 (file)
@@ -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".
index d3f5cff2c839ed579652c21dbc57ba12d638f0c7..ac9b088d66df21cc5ce0f51a6f1c8f382c66a2fd 100644 (file)
@@ -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++)
index 136348bd42e55a34e71ae8493d41fb1267d6307f..07d10008c654a1672f49e79dd0b80cb9e786d614 100644 (file)
@@ -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);
index 3a0e18841cfa377fd49125704f1c52077192c172..0d9e9d4a48064a3a3730c25be6d47e9cf2131b28 100644 (file)
@@ -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;
        }
 
index 18eb87936ba878f4f9b82c748dc1c63f199fe176..e92a97f1860066f08fac316db2d95e3874e3d526 100644 (file)
@@ -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;
index f643329c954d4631194655367561d63e537da309..1257aa0594a0f39b1643ba7c5160fdec52151b7c 100644 (file)
@@ -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;
     }
index daccfc868bf693fc1948ea693bbea95b46bb90fe..7589f8e0d1bf59ce915b167d55f568c605e5f6fa 100644 (file)
@@ -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()");
            }
 
            /*
index 55db53767a55bf1a9f16e59c52d0ee79e7fc8603..3657433a5175757c9cca1482d45f56c1366d607f 100644 (file)
@@ -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 */
index fea9543a78010cd8b08b3317e9c8f7c9fee1517c..c15e4f9bb997f8ce656d2a74a5a3c3a4ae385e2a 100644 (file)
@@ -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"));
index 4a7c06ed9cf20df3b3b28a3674c371b1d602cedc..8569f601275753dc1c6a62dd211039ff9adf86fa 100644 (file)
@@ -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;
     }
 
index be2158dc6d2daeba6da8224640d93f06e4f183d2..02c5ed16a6f43dcfe1f5287c283675d73b70e193 100644 (file)
@@ -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;
     }
 
index 1b5604be7ab045b6fe9f4c0d3b425e48def91c6c..60b3577ffa1bbbbfbb6accc9eaf5967581a8871f 100644 (file)
@@ -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 */
index d8d3aed286b4043aa3ce16d1906747440e4dc606..658bfb969468443222363130a928569aec06c3ed 100644 (file)
@@ -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);
index 9e7a362b2b22f632e5bfb7ae1e8ab29027af72dc..ce6b87f370b841a44ae65c19e8d23fabebf0039a 100644 (file)
@@ -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;
     }
 
index 36d47aa99d9525331abbb27eb47c20989b8c70db..4ec4411fb233b572b3c63e8f52c9606481789495 100644 (file)
@@ -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;
index 2f7520196dc65d3f2b0162d4590715820bed24b3..0fb27871ba8b2b0e9a71bf7ccb006f035860c51b 100644 (file)
@@ -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)
     {
index 37555e6e59827df8c3c9cd5ccba957fbfa890697..e3a4bdbc62c74b2015cec78d41a479ada43b5403 100644 (file)
@@ -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;
index f8152a7b50df8597103af1f2195e661d855e90df..32360a93b65bc384f857063178a21c4a836dfb67 100644 (file)
@@ -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
index 3803249de58a1e171599ccc360ed1d8a55d27b24..27d26bece90d38ca3f14fc5f586a6122062ccec7 100644 (file)
@@ -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.
index ecfdc40dcab247d5b520d5e7f3672dfe7f18c63b..2b9ba2dcfa70adb8c9aec39e9258bcb8e3c3c877 100644 (file)
@@ -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);
index 7112b0923f02564ef1b34d07cf93360744f1cef9..c9d62c66e0fad7d6bdcbadc03f98227aecfcc9ef 100644 (file)
@@ -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);
index d18ae2033068e7c972da34fb6334aab280e7a3e6..144324f6ed6d2d3c66941d58ed8eb31eddac118f 100644 (file)
@@ -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);
index a45faeaa9da9390b4d75cc488b8777edfec58a76..a563fa946bec5c3944357f661f246eee7acc3bf3 100644 (file)
@@ -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;
        }
 
index 8d63d5a2698b95e49c6beba0abf2defafee7d855..78d643174e7f97fab9a470e0c64073db8f181fd0 100644 (file)
@@ -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;
                }
            }
index eb81ad27bf8718fe92a87e96d8a59dfc417abc06..91a48fa77e03d95c6442c3495163615906a98d76 100644 (file)
@@ -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;
     }
 
index cc74edd943b48fd1e704577665012f1094216210..57c3c2021d8d0577d22fe0d47ece248c8dfd63a3 100644 (file)
@@ -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
index c75ccbc32478fec2458353b7e6686aa009857b0f..369d92ad60653f5cf63664962ab5cd9aeda423a9 100644 (file)
@@ -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()");
 }
 
 /*
index 6d125005c7e2a0fb9c667b6bb83f0c97fbba046b..80e30dcc69ac878bb2d483e82a006d6504eeef8e 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    74,
 /**/
     73,
 /**/
index 5946d63d2a9498dad5503ef0e8cf99e3e2183734..eec3e4f73f2067f5f9d0e0c96f33299dff4c9c82 100644 (file)
--- a/src/vim.h
+++ b/src/vim.h
@@ -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))
index c4448b77e2f5fad9ab2f79d7557a8f5e976bc4c6..8e5336883fd0599f2626420339b104077213e7e4 100644 (file)
@@ -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;