Patch 9.0.1454
Problem: Code indenting is confused by macros.
Solution: Put semicolon after the macros instead of inside. (Ozaki Kiichi,
closes #12257)
Files: src/autocmd.c, src/buffer.c, src/ex_docmd.c, src/macros.h,
src/main.c, src/map.c, src/scriptfile.c, src/spellfile.c,
src/userfunc.c
*** ../vim-9.0.1453/src/autocmd.c 2023-04-09 22:01:21.143306278 +0100
--- src/autocmd.c 2023-04-15 13:09:21.458340718 +0100
***************
*** 2020,2026 ****
save_redo_T save_redo;
int save_KeyTyped = KeyTyped;
int save_did_emsg;
! ESTACK_CHECK_DECLARATION
/*
* Quickly return if there are no autocommands for this event or
--- 2020,2026 ----
save_redo_T save_redo;
int save_KeyTyped = KeyTyped;
int save_did_emsg;
! ESTACK_CHECK_DECLARATION;
/*
* Quickly return if there are no autocommands for this event or
***************
*** 2226,2232 ****
// name and lnum are filled in later
estack_push(ETYPE_AUCMD, NULL, 0);
! ESTACK_CHECK_SETUP
save_current_sctx = current_sctx;
--- 2226,2232 ----
// name and lnum are filled in later
estack_push(ETYPE_AUCMD, NULL, 0);
! ESTACK_CHECK_SETUP;
save_current_sctx = current_sctx;
***************
*** 2339,2345 ****
filechangeshell_busy = FALSE;
autocmd_nested = save_autocmd_nested;
vim_free(SOURCING_NAME);
! ESTACK_CHECK_NOW
estack_pop();
vim_free(autocmd_fname);
autocmd_fname = save_autocmd_fname;
--- 2339,2345 ----
filechangeshell_busy = FALSE;
autocmd_nested = save_autocmd_nested;
vim_free(SOURCING_NAME);
! ESTACK_CHECK_NOW;
estack_pop();
vim_free(autocmd_fname);
autocmd_fname = save_autocmd_fname;
*** ../vim-9.0.1453/src/buffer.c 2023-03-07 17:45:07.180247902 +0000
--- src/buffer.c 2023-04-15 13:09:21.462340719 +0100
***************
*** 5641,5648 ****
int end;
int retval = OK;
sctx_T save_current_sctx;
!
! ESTACK_CHECK_DECLARATION
prev = -1;
for (s = ml_get(lnum); *s != NUL; ++s)
--- 5641,5647 ----
int end;
int retval = OK;
sctx_T save_current_sctx;
! ESTACK_CHECK_DECLARATION;
prev = -1;
for (s = ml_get(lnum); *s != NUL; ++s)
***************
*** 5686,5692 ****
// prepare for emsg()
estack_push(ETYPE_MODELINE, (char_u *)"modelines", lnum);
! ESTACK_CHECK_SETUP
end = FALSE;
while (end == FALSE)
--- 5685,5691 ----
// prepare for emsg()
estack_push(ETYPE_MODELINE, (char_u *)"modelines", lnum);
! ESTACK_CHECK_SETUP;
end = FALSE;
while (end == FALSE)
***************
*** 5747,5753 ****
s = e + 1; // advance to next part
}
! ESTACK_CHECK_NOW
estack_pop();
vim_free(linecopy);
}
--- 5746,5752 ----
s = e + 1; // advance to next part
}
! ESTACK_CHECK_NOW;
estack_pop();
vim_free(linecopy);
}
*** ../vim-9.0.1453/src/ex_docmd.c 2023-03-12 21:20:51.437254187 +0000
--- src/ex_docmd.c 2023-04-15 13:09:21.462340719 +0100
***************
*** 1390,1396 ****
{
char *p = NULL;
msglist_T *messages = NULL;
! ESTACK_CHECK_DECLARATION
/*
* If the uncaught exception is a user exception, report it as an
--- 1390,1396 ----
{
char *p = NULL;
msglist_T *messages = NULL;
! ESTACK_CHECK_DECLARATION;
/*
* If the uncaught exception is a user exception, report it as an
***************
*** 1416,1422 ****
estack_push(ETYPE_EXCEPT, current_exception->throw_name,
current_exception->throw_lnum);
! ESTACK_CHECK_SETUP
current_exception->throw_name = NULL;
discard_current_exception(); // uses IObuff if 'verbose'
--- 1416,1422 ----
estack_push(ETYPE_EXCEPT, current_exception->throw_name,
current_exception->throw_lnum);
! ESTACK_CHECK_SETUP;
current_exception->throw_name = NULL;
discard_current_exception(); // uses IObuff if 'verbose'
***************
*** 1446,1452 ****
vim_free(p);
}
vim_free(SOURCING_NAME);
! ESTACK_CHECK_NOW
estack_pop();
}
--- 1446,1452 ----
vim_free(p);
}
vim_free(SOURCING_NAME);
! ESTACK_CHECK_NOW;
estack_pop();
}
*** ../vim-9.0.1453/src/macros.h 2023-03-07 17:13:47.309107774 +0000
--- src/macros.h 2023-04-15 13:09:21.462340719 +0100
***************
*** 366,386 ****
#ifdef ABORT_ON_INTERNAL_ERROR
! # define ESTACK_CHECK_DECLARATION int estack_len_before;
! # define ESTACK_CHECK_SETUP estack_len_before = exestack.ga_len;
! # define ESTACK_CHECK_NOW if (estack_len_before != exestack.ga_len) \
! siemsg("Exestack length expected: %d, actual: %d", estack_len_before, exestack.ga_len);
! # define CHECK_CURBUF if (curwin != NULL && curwin->w_buffer != curbuf) \
! iemsg("curbuf != curwin->w_buffer")
#else
! # define ESTACK_CHECK_DECLARATION
! # define ESTACK_CHECK_SETUP
! # define ESTACK_CHECK_NOW
! # define CHECK_CURBUF
#endif
// Inline the condition for performance.
! #define CHECK_LIST_MATERIALIZE(l) if ((l)->lv_first == &range_list_item) range_list_materialize(l)
// Inlined version of ga_grow() with optimized condition that it fails.
#define GA_GROW_FAILS(gap, n) unlikely((((gap)->ga_maxlen - (gap)->ga_len < (n)) ? ga_grow_inner((gap), (n)) : OK) == FAIL)
--- 366,396 ----
#ifdef ABORT_ON_INTERNAL_ERROR
! # define ESTACK_CHECK_DECLARATION int estack_len_before
! # define ESTACK_CHECK_SETUP do { estack_len_before = exestack.ga_len; } while (0)
! # define ESTACK_CHECK_NOW \
! do { \
! if (estack_len_before != exestack.ga_len) \
! siemsg("Exestack length expected: %d, actual: %d", estack_len_before, exestack.ga_len); \
! } while (0)
! # define CHECK_CURBUF \
! do { \
! if (curwin != NULL && curwin->w_buffer != curbuf) \
! iemsg("curbuf != curwin->w_buffer"); \
! } while (0)
#else
! # define ESTACK_CHECK_DECLARATION do { /**/ } while (0)
! # define ESTACK_CHECK_SETUP do { /**/ } while (0)
! # define ESTACK_CHECK_NOW do { /**/ } while (0)
! # define CHECK_CURBUF do { /**/ } while (0)
#endif
// Inline the condition for performance.
! #define CHECK_LIST_MATERIALIZE(l) \
! do { \
! if ((l)->lv_first == &range_list_item) \
! range_list_materialize(l); \
! } while (0)
// Inlined version of ga_grow() with optimized condition that it fails.
#define GA_GROW_FAILS(gap, n) unlikely((((gap)->ga_maxlen - (gap)->ga_len < (n)) ? ga_grow_inner((gap), (n)) : OK) == FAIL)
*** ../vim-9.0.1453/src/main.c 2023-03-25 20:06:10.500816586 +0000
--- src/main.c 2023-04-15 13:09:21.462340719 +0100
***************
*** 3101,3121 ****
char_u **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
int i;
! ESTACK_CHECK_DECLARATION
if (cnt <= 0)
return;
curwin->w_cursor.lnum = 0; // just in case..
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
! ESTACK_CHECK_SETUP
# ifdef FEAT_EVAL
! current_sctx.sc_sid = SID_CMDARG;
# endif
! for (i = 0; i < cnt; ++i)
! do_cmdline_cmd(cmds[i]);
! ESTACK_CHECK_NOW
! estack_pop();
# ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
# endif
--- 3101,3121 ----
char_u **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands;
int i;
! ESTACK_CHECK_DECLARATION;
if (cnt <= 0)
return;
curwin->w_cursor.lnum = 0; // just in case..
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
! ESTACK_CHECK_SETUP;
# ifdef FEAT_EVAL
! current_sctx.sc_sid = SID_CMDARG;
# endif
! for (i = 0; i < cnt; ++i)
! do_cmdline_cmd(cmds[i]);
! ESTACK_CHECK_NOW;
! estack_pop();
# ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
# endif
***************
*** 3129,3135 ****
exe_commands(mparm_T *parmp)
{
int i;
! ESTACK_CHECK_DECLARATION
/*
* We start commands on line 0, make "vim +/pat file" match a
--- 3129,3135 ----
exe_commands(mparm_T *parmp)
{
int i;
! ESTACK_CHECK_DECLARATION;
/*
* We start commands on line 0, make "vim +/pat file" match a
***************
*** 3140,3146 ****
if (parmp->tagname == NULL && curwin->w_cursor.lnum <= 1)
curwin->w_cursor.lnum = 0;
estack_push(ETYPE_ARGS, (char_u *)"command line", 0);
! ESTACK_CHECK_SETUP
#ifdef FEAT_EVAL
current_sctx.sc_sid = SID_CARG;
current_sctx.sc_seq = 0;
--- 3140,3146 ----
if (parmp->tagname == NULL && curwin->w_cursor.lnum <= 1)
curwin->w_cursor.lnum = 0;
estack_push(ETYPE_ARGS, (char_u *)"command line", 0);
! ESTACK_CHECK_SETUP;
#ifdef FEAT_EVAL
current_sctx.sc_sid = SID_CARG;
current_sctx.sc_seq = 0;
***************
*** 3151,3157 ****
if (parmp->cmds_tofree[i])
vim_free(parmp->commands[i]);
}
! ESTACK_CHECK_NOW
estack_pop();
#ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
--- 3151,3157 ----
if (parmp->cmds_tofree[i])
vim_free(parmp->commands[i]);
}
! ESTACK_CHECK_NOW;
estack_pop();
#ifdef FEAT_EVAL
current_sctx.sc_sid = 0;
***************
*** 3370,3377 ****
{
char_u *initstr;
sctx_T save_current_sctx;
!
! ESTACK_CHECK_DECLARATION
if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL)
return FAIL;
--- 3370,3376 ----
{
char_u *initstr;
sctx_T save_current_sctx;
! ESTACK_CHECK_DECLARATION;
if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL)
return FAIL;
***************
*** 3379,3386 ****
if (is_viminit)
vimrc_found(NULL, NULL);
estack_push(ETYPE_ENV, env, 0);
! ESTACK_CHECK_SETUP
! save_current_sctx = current_sctx;
current_sctx.sc_version = 1;
#ifdef FEAT_EVAL
current_sctx.sc_sid = SID_ENV;
--- 3378,3385 ----
if (is_viminit)
vimrc_found(NULL, NULL);
estack_push(ETYPE_ENV, env, 0);
! ESTACK_CHECK_SETUP;
! save_current_sctx = current_sctx;
current_sctx.sc_version = 1;
#ifdef FEAT_EVAL
current_sctx.sc_sid = SID_ENV;
***************
*** 3390,3397 ****
do_cmdline_cmd(initstr);
! ESTACK_CHECK_NOW
! estack_pop();
current_sctx = save_current_sctx;
return OK;
}
--- 3389,3396 ----
do_cmdline_cmd(initstr);
! ESTACK_CHECK_NOW;
! estack_pop();
current_sctx = save_current_sctx;
return OK;
}
*** ../vim-9.0.1453/src/map.c 2023-04-07 22:09:42.624287094 +0100
--- src/map.c 2023-04-15 13:09:21.462340719 +0100
***************
*** 2231,2242 ****
int abbr;
int hash;
buf_T *bp;
! ESTACK_CHECK_DECLARATION
validate_maphash();
// avoids giving error messages
estack_push(ETYPE_INTERNAL, (char_u *)"mappings", 0);
! ESTACK_CHECK_SETUP
// Do this once for each buffer, and then once for global
// mappings/abbreviations with bp == NULL
--- 2231,2242 ----
int abbr;
int hash;
buf_T *bp;
! ESTACK_CHECK_DECLARATION;
validate_maphash();
// avoids giving error messages
estack_push(ETYPE_INTERNAL, (char_u *)"mappings", 0);
! ESTACK_CHECK_SETUP;
// Do this once for each buffer, and then once for global
// mappings/abbreviations with bp == NULL
***************
*** 2293,2299 ****
if (bp == NULL)
break;
}
! ESTACK_CHECK_NOW
estack_pop();
}
--- 2293,2299 ----
if (bp == NULL)
break;
}
! ESTACK_CHECK_NOW;
estack_pop();
}
*** ../vim-9.0.1453/src/scriptfile.c 2023-04-01 13:51:56.846068822 +0100
--- src/scriptfile.c 2023-04-15 13:09:21.462340719 +0100
***************
*** 1450,1463 ****
char_u *firstline = NULL;
int retval = FAIL;
sctx_T save_current_sctx;
- #ifdef FEAT_EVAL
- funccal_entry_T funccalp_entry;
- int save_debug_break_level = debug_break_level;
- int sid = -1;
- scriptitem_T *si = NULL;
- int save_estack_compiling = estack_compiling;
- ESTACK_CHECK_DECLARATION
- #endif
#ifdef STARTUPTIME
struct timeval tv_rel;
struct timeval tv_start;
--- 1450,1455 ----
***************
*** 1467,1472 ****
--- 1459,1472 ----
#endif
int save_sticky_cmdmod_flags = sticky_cmdmod_flags;
int trigger_source_post = FALSE;
+ #ifdef FEAT_EVAL
+ funccal_entry_T funccalp_entry;
+ int save_debug_break_level = debug_break_level;
+ int sid = -1;
+ scriptitem_T *si = NULL;
+ int save_estack_compiling = estack_compiling;
+ ESTACK_CHECK_DECLARATION;
+ #endif
CLEAR_FIELD(cookie);
if (fname == NULL)
***************
*** 1711,1717 ****
// Keep the sourcing name/lnum, for recursive calls.
estack_push(ETYPE_SCRIPT, si->sn_name, 0);
! ESTACK_CHECK_SETUP
# ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
--- 1711,1717 ----
// Keep the sourcing name/lnum, for recursive calls.
estack_push(ETYPE_SCRIPT, si->sn_name, 0);
! ESTACK_CHECK_SETUP;
# ifdef FEAT_PROFILE
if (do_profiling == PROF_YES)
***************
*** 1780,1786 ****
if (got_int)
emsg(_(e_interrupted));
#ifdef FEAT_EVAL
! ESTACK_CHECK_NOW
#endif
estack_pop();
if (p_verbose > 1)
--- 1780,1786 ----
if (got_int)
emsg(_(e_interrupted));
#ifdef FEAT_EVAL
! ESTACK_CHECK_NOW;
#endif
estack_pop();
if (p_verbose > 1)
*** ../vim-9.0.1453/src/spellfile.c 2023-03-07 17:13:47.313107772 +0000
--- src/spellfile.c 2023-04-15 13:09:21.466340717 +0100
***************
*** 356,362 ****
int c = 0;
int res;
int did_estack_push = FALSE;
! ESTACK_CHECK_DECLARATION
fd = mch_fopen((char *)fname, "r");
if (fd == NULL)
--- 356,362 ----
int c = 0;
int res;
int did_estack_push = FALSE;
! ESTACK_CHECK_DECLARATION;
fd = mch_fopen((char *)fname, "r");
if (fd == NULL)
***************
*** 397,403 ****
// Set sourcing_name, so that error messages mention the file name.
estack_push(ETYPE_SPELL, fname, 0);
! ESTACK_CHECK_SETUP
did_estack_push = TRUE;
/*
--- 397,403 ----
// Set sourcing_name, so that error messages mention the file name.
estack_push(ETYPE_SPELL, fname, 0);
! ESTACK_CHECK_SETUP;
did_estack_push = TRUE;
/*
***************
*** 588,594 ****
fclose(fd);
if (did_estack_push)
{
! ESTACK_CHECK_NOW
estack_pop();
}
--- 588,594 ----
fclose(fd);
if (did_estack_push)
{
! ESTACK_CHECK_NOW;
estack_pop();
}
*** ../vim-9.0.1453/src/userfunc.c 2023-04-12 20:48:09.335718024 +0100
--- src/userfunc.c 2023-04-15 13:09:21.466340717 +0100
***************
*** 2748,2754 ****
#ifdef FEAT_PROFILE
profinfo_T profile_info;
#endif
! ESTACK_CHECK_DECLARATION
#ifdef FEAT_PROFILE
CLEAR_FIELD(profile_info);
--- 2748,2754 ----
#ifdef FEAT_PROFILE
profinfo_T profile_info;
#endif
! ESTACK_CHECK_DECLARATION;
#ifdef FEAT_PROFILE
CLEAR_FIELD(profile_info);
***************
*** 2963,2969 ****
}
estack_push_ufunc(fp, 1);
! ESTACK_CHECK_SETUP
if (p_verbose >= 12)
{
++no_wait_return;
--- 2963,2969 ----
}
estack_push_ufunc(fp, 1);
! ESTACK_CHECK_SETUP;
if (p_verbose >= 12)
{
++no_wait_return;
***************
*** 3117,3123 ****
--no_wait_return;
}
! ESTACK_CHECK_NOW
estack_pop();
current_sctx = save_current_sctx;
restore_current_ectx(save_current_ectx);
--- 3117,3123 ----
--no_wait_return;
}
! ESTACK_CHECK_NOW;
estack_pop();
current_sctx = save_current_sctx;
restore_current_ectx(save_current_ectx);
*** ../vim-9.0.1453/src/version.c 2023-04-14 21:54:21.096430659 +0100
--- src/version.c 2023-04-15 13:11:02.166079164 +0100
***************
*** 697,698 ****
--- 697,700 ----
{ /* Add new patch number below this line */
+ /**/
+ 1454,
/**/
--
I bought a book on hair loss, but the pages keep falling out.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///