Patch 8.0.1688
Problem: Some macros are used without a semicolon, causing auto-indent to be
wrong.
Solution: Use the do-while(0) trick. (Ozaki Kiichi, closes #2729)
Files: src/buffer.c, src/dosinst.c, src/ex_cmds.c, src/gui_at_sb.c,
src/macros.h, src/main.c, src/memline.c, src/option.c,
src/os_vms.c, src/screen.c, src/window.c
*** ../vim-8.0.1687/src/buffer.c 2018-03-29 16:36:32.565685046 +0200
--- src/buffer.c 2018-04-10 18:37:19.305748327 +0200
***************
*** 1764,1770 ****
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
--- 1764,1770 ----
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR;
#ifdef FEAT_KEYMAP
if (curbuf->b_kmap_state & KEYMAP_INIT)
*** ../vim-8.0.1687/src/dosinst.c 2018-02-27 17:25:48.020151886 +0100
--- src/dosinst.c 2018-04-10 18:37:19.305748327 +0200
***************
*** 23,29 ****
#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll"
/* Macro to do an error check I was typing over and over */
! #define CHECK_REG_ERROR(code) if (code != ERROR_SUCCESS) { printf("%ld error
number: %ld\n", (long)__LINE__, (long)code); return 1; }
int has_vim = 0; /* installable vim.exe exists */
int has_gvim = 0; /* installable gvim.exe exists */
--- 23,36 ----
#define GVIMEXT32_PATH "GvimExt32\\gvimext.dll"
/* Macro to do an error check I was typing over and over */
! #define CHECK_REG_ERROR(code) \
! do { \
! if (code != ERROR_SUCCESS) \
! { \
! printf("%ld error number: %ld\n", (long)__LINE__, (long)code); \
! return 1; \
! } \
! } while (0)
int has_vim = 0; /* installable vim.exe exists */
int has_gvim = 0; /* installable gvim.exe exists */
*** ../vim-8.0.1687/src/ex_cmds.c 2018-03-29 16:03:46.620035905 +0200
--- src/ex_cmds.c 2018-04-10 18:37:19.309748299 +0200
***************
*** 2996,3002 ****
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
return OK;
}
--- 2996,3002 ----
apply_autocmds(EVENT_BUFFILEPOST, NULL, NULL, FALSE, curbuf);
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR;
return OK;
}
***************
*** 3254,3260 ****
* got changed or set. */
if (eap->cmdidx == CMD_saveas || name_was_missing)
{
! DO_AUTOCHDIR
}
}
--- 3254,3260 ----
* got changed or set. */
if (eap->cmdidx == CMD_saveas || name_was_missing)
{
! DO_AUTOCHDIR;
}
}
***************
*** 4147,4153 ****
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
/*
* Careful: open_buffer() and apply_autocmds() may change the current
--- 4147,4153 ----
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR;
/*
* Careful: open_buffer() and apply_autocmds() may change the current
*** ../vim-8.0.1687/src/gui_at_sb.c 2017-02-25 16:01:41.062484813 +0100
--- src/gui_at_sb.c 2018-04-10 18:37:19.309748299 +0200
***************
*** 645,651 ****
static Boolean
CompareEvents(XEvent *oldEvent, XEvent *newEvent)
{
! #define Check(field) if (newEvent->field != oldEvent->field) return False;
Check(xany.display);
Check(xany.type);
--- 645,655 ----
static Boolean
CompareEvents(XEvent *oldEvent, XEvent *newEvent)
{
! #define Check(field) \
! do { \
! if (newEvent->field != oldEvent->field) \
! return False; \
! } while (0)
Check(xany.display);
Check(xany.type);
*** ../vim-8.0.1687/src/macros.h 2018-03-04 20:14:08.252064314 +0100
--- src/macros.h 2018-04-10 18:37:19.309748299 +0200
***************
*** 230,238 ****
#endif
#ifdef STARTUPTIME
! # define TIME_MSG(s) { if (time_fd != NULL) time_msg(s, NULL); }
#else
! # define TIME_MSG(s)
#endif
#ifdef FEAT_VREPLACE
--- 230,238 ----
#endif
#ifdef STARTUPTIME
! # define TIME_MSG(s) do { if (time_fd != NULL) time_msg(s, NULL); } while (0)
#else
! # define TIME_MSG(s) do { /**/ } while (0)
#endif
#ifdef FEAT_VREPLACE
***************
*** 289,297 ****
#endif
#ifdef FEAT_AUTOCHDIR
! # define DO_AUTOCHDIR if (p_acd) do_autochdir();
#else
! # define DO_AUTOCHDIR
#endif
#define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
--- 289,297 ----
#endif
#ifdef FEAT_AUTOCHDIR
! # define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)
#else
! # define DO_AUTOCHDIR do { /**/ } while (0)
#endif
#define RESET_BINDING(wp) (wp)->w_p_scb = FALSE; (wp)->w_p_crb = FALSE
*** ../vim-8.0.1687/src/main.c 2018-03-22 20:33:39.404033784 +0100
--- src/main.c 2018-04-10 18:37:19.309748299 +0200
***************
*** 824,830 ****
no_wait_return = FALSE;
/* 'autochdir' has been postponed */
! DO_AUTOCHDIR
#ifdef FEAT_TERMRESPONSE
/* Requesting the termresponse is postponed until here, so that a "-c q"
--- 824,830 ----
no_wait_return = FALSE;
/* 'autochdir' has been postponed */
! DO_AUTOCHDIR;
#ifdef FEAT_TERMRESPONSE
/* Requesting the termresponse is postponed until here, so that a "-c q"
*** ../vim-8.0.1687/src/memline.c 2018-03-04 18:07:04.260592398 +0100
--- src/memline.c 2018-04-10 18:37:19.309748299 +0200
***************
*** 8,15 ****
*/
/* for debugging */
! /* #define CHECK(c, s) if (c) EMSG(s) */
! #define CHECK(c, s)
/*
* memline.c: Contains the functions for appending, deleting and changing the
--- 8,15 ----
*/
/* for debugging */
! /* #define CHECK(c, s) do { if (c) EMSG(s); } while (0) */
! #define CHECK(c, s) do { /**/ } while (0)
/*
* memline.c: Contains the functions for appending, deleting and changing the
*** ../vim-8.0.1687/src/option.c 2018-03-09 21:33:29.240607424 +0100
--- src/option.c 2018-04-10 18:37:19.313748270 +0200
***************
*** 8456,8462 ****
else if ((int *)varp == &p_acd)
{
/* Change directories when the 'acd' option is set now. */
! DO_AUTOCHDIR
}
#endif
--- 8456,8462 ----
else if ((int *)varp == &p_acd)
{
/* Change directories when the 'acd' option is set now. */
! DO_AUTOCHDIR;
}
#endif
*** ../vim-8.0.1687/src/os_vms.c 2018-02-27 17:25:48.020151886 +0100
--- src/os_vms.c 2018-04-10 18:37:19.313748270 +0200
***************
*** 83,89 ****
#define EXPL_ALLOC_INC 64
#define EQN(S1,S2,LN) (strncmp(S1,S2,LN) == 0)
! #define SKIP_FOLLOWING_SLASHES(Str) while (Str[1] == '/') ++Str
/*
--- 83,89 ----
#define EXPL_ALLOC_INC 64
#define EQN(S1,S2,LN) (strncmp(S1,S2,LN) == 0)
! #define SKIP_FOLLOWING_SLASHES(Str) do { while (Str[1] == '/') ++Str; } while
(0)
/*
*** ../vim-8.0.1687/src/screen.c 2018-03-12 21:48:27.492618748 +0100
--- src/screen.c 2018-04-10 18:37:19.317748242 +0200
***************
*** 2705,2719 ****
}
#ifdef FEAT_RIGHTLEFT
! # define RL_MEMSET(p, v, l) if (wp->w_p_rl) \
! for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (wp->w_width - (p) - (l))
+ ri] = v; \
! else \
! for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (p) + ri] = v
#else
! # define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (p) + ri] = v
#endif
/* Set all attributes of the 'number' or 'relativenumber' column and the
--- 2705,2725 ----
}
#ifdef FEAT_RIGHTLEFT
! # define RL_MEMSET(p, v, l) \
! do { \
! if (wp->w_p_rl) \
! for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \
! else \
! for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (p) + ri] = v; \
! } while (0)
#else
! # define RL_MEMSET(p, v, l) \
! do { \
! for (ri = 0; ri < l; ++ri) \
! ScreenAttrs[off + (p) + ri] = v; \
! } while (0)
#endif
/* Set all attributes of the 'number' or 'relativenumber' column and the
*** ../vim-8.0.1687/src/window.c 2018-03-04 20:14:08.252064314 +0100
--- src/window.c 2018-04-10 18:37:19.317748242 +0200
***************
*** 99,107 ****
Prenum1 = Prenum;
#ifdef FEAT_CMDWIN
! # define CHECK_CMDWIN if (cmdwin_type != 0) { EMSG(_(e_cmdwin)); break; }
#else
! # define CHECK_CMDWIN
#endif
switch (nchar)
--- 99,114 ----
Prenum1 = Prenum;
#ifdef FEAT_CMDWIN
! # define CHECK_CMDWIN \
! do { \
! if (cmdwin_type != 0) \
! { \
! EMSG(_(e_cmdwin)); \
! return; \
! } \
! } while (0)
#else
! # define CHECK_CMDWIN do { /**/ } while (0)
#endif
switch (nchar)
***************
*** 110,116 ****
case 'S':
case Ctrl_S:
case 's':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
/* When splitting the quickfix window open a new buffer in it,
--- 117,123 ----
case 'S':
case Ctrl_S:
case 's':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
/* When splitting the quickfix window open a new buffer in it,
***************
*** 127,133 ****
/* split current window in two parts, vertically */
case Ctrl_V:
case 'v':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
/* When splitting the quickfix window open a new buffer in it,
--- 134,140 ----
/* split current window in two parts, vertically */
case Ctrl_V:
case 'v':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
/* When splitting the quickfix window open a new buffer in it,
***************
*** 144,150 ****
/* split current window and edit alternate file */
case Ctrl_HAT:
case '^':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
--- 151,157 ----
/* split current window and edit alternate file */
case Ctrl_HAT:
case '^':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
***************
*** 153,159 ****
/* open new window */
case Ctrl_N:
case 'n':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
newwindow:
--- 160,166 ----
/* open new window */
case Ctrl_N:
case 'n':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
#ifdef FEAT_QUICKFIX
newwindow:
***************
*** 191,197 ****
/* close preview window */
case Ctrl_Z:
case 'z':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
do_cmdline_cmd((char_u *)"pclose");
break;
--- 198,204 ----
/* close preview window */
case Ctrl_Z:
case 'z':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
do_cmdline_cmd((char_u *)"pclose");
break;
***************
*** 211,217 ****
/* close all but current window */
case Ctrl_O:
case 'o':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
--- 218,224 ----
/* close all but current window */
case Ctrl_O:
case 'o':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
***************
*** 222,228 ****
case 'w':
/* cursor to previous window with wrap around */
case 'W':
! CHECK_CMDWIN
if (ONE_WINDOW && Prenum != 1) /* just one window */
beep_flush();
else
--- 229,235 ----
case 'w':
/* cursor to previous window with wrap around */
case 'W':
! CHECK_CMDWIN;
if (ONE_WINDOW && Prenum != 1) /* just one window */
beep_flush();
else
***************
*** 260,266 ****
case 'j':
case K_DOWN:
case Ctrl_J:
! CHECK_CMDWIN
win_goto_ver(FALSE, Prenum1);
break;
--- 267,273 ----
case 'j':
case K_DOWN:
case Ctrl_J:
! CHECK_CMDWIN;
win_goto_ver(FALSE, Prenum1);
break;
***************
*** 268,274 ****
case 'k':
case K_UP:
case Ctrl_K:
! CHECK_CMDWIN
win_goto_ver(TRUE, Prenum1);
break;
--- 275,281 ----
case 'k':
case K_UP:
case Ctrl_K:
! CHECK_CMDWIN;
win_goto_ver(TRUE, Prenum1);
break;
***************
*** 277,283 ****
case K_LEFT:
case Ctrl_H:
case K_BS:
! CHECK_CMDWIN
win_goto_hor(TRUE, Prenum1);
break;
--- 284,290 ----
case K_LEFT:
case Ctrl_H:
case K_BS:
! CHECK_CMDWIN;
win_goto_hor(TRUE, Prenum1);
break;
***************
*** 285,291 ****
case 'l':
case K_RIGHT:
case Ctrl_L:
! CHECK_CMDWIN
win_goto_hor(FALSE, Prenum1);
break;
--- 292,298 ----
case 'l':
case K_RIGHT:
case Ctrl_L:
! CHECK_CMDWIN;
win_goto_hor(FALSE, Prenum1);
break;
***************
*** 338,358 ****
/* exchange current and next window */
case 'x':
case Ctrl_X:
! CHECK_CMDWIN
win_exchange(Prenum);
break;
/* rotate windows downwards */
case Ctrl_R:
case 'r':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
win_rotate(FALSE, (int)Prenum1); /* downwards */
break;
/* rotate windows upwards */
case 'R':
! CHECK_CMDWIN
reset_VIsual_and_resel(); /* stop Visual mode */
win_rotate(TRUE, (int)Prenum1); /* upwards */
break;
--- 345,365 ----
/* exchange current and next window */
case 'x':
case Ctrl_X:
! CHECK_CMDWIN;
win_exchange(Prenum);
break;
/* rotate windows downwards */
case Ctrl_R:
case 'r':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
win_rotate(FALSE, (int)Prenum1); /* downwards */
break;
/* rotate windows upwards */
case 'R':
! CHECK_CMDWIN;
reset_VIsual_and_resel(); /* stop Visual mode */
win_rotate(TRUE, (int)Prenum1); /* upwards */
break;
***************
*** 362,368 ****
case 'J':
case 'H':
case 'L':
! CHECK_CMDWIN
win_totop((int)Prenum,
((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)
| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));
--- 369,375 ----
case 'J':
case 'H':
case 'L':
! CHECK_CMDWIN;
win_totop((int)Prenum,
((nchar == 'H' || nchar == 'L') ? WSP_VERT : 0)
| ((nchar == 'H' || nchar == 'K') ? WSP_TOP : WSP_BOT));
***************
*** 428,434 ****
/* jump to tag and split window if tag exists (in preview window) */
#if defined(FEAT_QUICKFIX)
case '}':
! CHECK_CMDWIN
if (Prenum)
g_do_tagpreview = Prenum;
else
--- 435,441 ----
/* jump to tag and split window if tag exists (in preview window) */
#if defined(FEAT_QUICKFIX)
case '}':
! CHECK_CMDWIN;
if (Prenum)
g_do_tagpreview = Prenum;
else
***************
*** 437,443 ****
/* FALLTHROUGH */
case ']':
case Ctrl_RSB:
! CHECK_CMDWIN
/* keep Visual mode, can select words to use as a tag */
if (Prenum)
postponed_split = Prenum;
--- 444,450 ----
/* FALLTHROUGH */
case ']':
case Ctrl_RSB:
! CHECK_CMDWIN;
/* keep Visual mode, can select words to use as a tag */
if (Prenum)
postponed_split = Prenum;
***************
*** 459,465 ****
case 'F':
case Ctrl_F:
wingotofile:
! CHECK_CMDWIN
ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL)
--- 466,472 ----
case 'F':
case Ctrl_F:
wingotofile:
! CHECK_CMDWIN;
ptr = grab_file_name(Prenum1, &lnum);
if (ptr != NULL)
***************
*** 503,509 ****
/* FALLTHROUGH */
case 'd': /* Go to definition, using 'define' */
case Ctrl_D:
! CHECK_CMDWIN
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)
break;
find_pattern_in_path(ptr, 0, len, TRUE,
--- 510,516 ----
/* FALLTHROUGH */
case 'd': /* Go to definition, using 'define' */
case Ctrl_D:
! CHECK_CMDWIN;
if ((len = find_ident_under_cursor(&ptr, FIND_IDENT)) == 0)
break;
find_pattern_in_path(ptr, 0, len, TRUE,
***************
*** 534,540 ****
/* CTRL-W g extended commands */
case 'g':
case Ctrl_G:
! CHECK_CMDWIN
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
--- 541,547 ----
/* CTRL-W g extended commands */
case 'g':
case Ctrl_G:
! CHECK_CMDWIN;
#ifdef USE_ON_FLY_SCROLL
dont_scroll = TRUE; /* disallow scrolling here */
#endif
***************
*** 4273,4281 ****
win_T *wp,
int undo_sync,
int curwin_invalid,
! int trigger_new_autocmds UNUSED,
! int trigger_enter_autocmds UNUSED,
! int trigger_leave_autocmds UNUSED)
{
int other_buffer = FALSE;
--- 4280,4288 ----
win_T *wp,
int undo_sync,
int curwin_invalid,
! int trigger_new_autocmds,
! int trigger_enter_autocmds,
! int trigger_leave_autocmds)
{
int other_buffer = FALSE;
***************
*** 4385,4391 ****
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR
}
--- 4392,4398 ----
#endif
/* Change directories when the 'acd' option is set. */
! DO_AUTOCHDIR;
}
*** ../vim-8.0.1687/src/version.c 2018-04-10 18:26:22.910554732 +0200
--- src/version.c 2018-04-10 18:37:00.969879381 +0200
***************
*** 764,765 ****
--- 764,767 ----
{ /* Add new patch number below this line */
+ /**/
+ 1688,
/**/
--
You are not really successful until someone claims he sat
beside you in school.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.