summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2023-05-09 15:00:00 +0100
committerBram Moolenaar <Bram@vim.org>2023-05-09 15:00:00 +0100
commitc9471b18728b1b37c04845ca2bc59fc981308b2d (patch)
treedafcc679138813e74a19d656f7a582d36e9d3ea3
parentdda01c05c2ded3f0d11703bd983a19b6ca7d5055 (diff)
downloadvim-git-c9471b18728b1b37c04845ca2bc59fc981308b2d.tar.gz
patch 9.0.1529: code style test doesn't check for space after "if"v9.0.1529
Problem: Code style test doesn't check for space after "if". Solution: Add a test for space.
-rw-r--r--src/cindent.c6
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/gui_w32.c4
-rw-r--r--src/macros.h2
-rw-r--r--src/os_amiga.c4
-rw-r--r--src/os_win32.c2
-rw-r--r--src/regexp_nfa.c2
-rw-r--r--src/testdir/test_codestyle.vim4
-rw-r--r--src/version.c2
9 files changed, 17 insertions, 11 deletions
diff --git a/src/cindent.c b/src/cindent.c
index 176bc0528..9b2b6442a 100644
--- a/src/cindent.c
+++ b/src/cindent.c
@@ -1854,8 +1854,8 @@ parse_cino(buf_T *buf)
// Handle C++ namespace.
buf->b_ind_cpp_namespace = 0;
- // Handle continuation lines containing conditions of if(), for() and
- // while().
+ // Handle continuation lines containing conditions of if (), for () and
+ // while ().
buf->b_ind_if_for_while = 0;
// indentation for # comments
@@ -3317,7 +3317,7 @@ get_c_indent(void)
}
// Special trick: when expecting the while () after a
- // do, line up with the while()
+ // do, line up with the while ()
// do
// x = 1;
// -> here
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index 567b839cd..45ccb5237 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -508,7 +508,7 @@ ex_listdo(exarg_T *eap)
i++;
break;
case CMD_tabdo:
- for( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next)
+ for ( ; tp != NULL && i + 1 < eap->line1; tp = tp->tp_next)
i++;
break;
case CMD_argdo:
diff --git a/src/gui_w32.c b/src/gui_w32.c
index 7a1203266..8e36f8d5a 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -8736,7 +8736,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args)
// If there are modifiers in the args, and it is not a keyup event and
// vkCode is not a modifier key, then we generate virtual modifier key
// messages before sending the actual key message.
- if(mods && STRICMP(event, "keydown") == 0 && !isModKey)
+ if (mods && STRICMP(event, "keydown") == 0 && !isModKey)
{
int n = 0;
if (mods & MOD_MASK_SHIFT)
@@ -8769,7 +8769,7 @@ test_gui_w32_sendevent_keyboard(dict_T *args)
if (STRICMP(event, "keyup") == 0)
{
inputs[0].ki.dwFlags = KEYEVENTF_KEYUP;
- if(!isModKey)
+ if (!isModKey)
unwrapMods = TRUE;
}
diff --git a/src/macros.h b/src/macros.h
index a8c6e43d3..b41a81827 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -240,7 +240,7 @@
#define MB_CHARLEN(p) (has_mbyte ? mb_charlen(p) : (int)STRLEN(p))
#define MB_CHAR2LEN(c) (has_mbyte ? mb_char2len(c) : 1)
#define PTR2CHAR(p) (has_mbyte ? mb_ptr2char(p) : (int)*(p))
-#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while(0)
+#define MB_CHAR2BYTES(c, b) do { if (has_mbyte) (b) += (*mb_char2bytes)((c), (b)); else *(b)++ = (c); } while (0)
#ifdef FEAT_AUTOCHDIR
# define DO_AUTOCHDIR do { if (p_acd) do_autochdir(); } while (0)
diff --git a/src/os_amiga.c b/src/os_amiga.c
index bc4ecc961..d09974f94 100644
--- a/src/os_amiga.c
+++ b/src/os_amiga.c
@@ -921,8 +921,8 @@ mch_can_exe(char_u *name, char_u **path UNUSED, int use_path)
struct PathNode *head = DupCmdPathList(NULL);
// For each entry, recur to check for executable.
- for(struct PathNode *tail = head; !exe && tail;
- tail = (struct PathNode *) BADDR(tail->pn_Next))
+ for (struct PathNode *tail = head; !exe && tail;
+ tail = (struct PathNode *) BADDR(tail->pn_Next))
{
SetCurrentDir(tail->pn_Lock);
exe = mch_can_exe(name, path, 0);
diff --git a/src/os_win32.c b/src/os_win32.c
index c43a31afc..869f02f65 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -6863,7 +6863,7 @@ write_chars(
vim_free(unicodebuf);
unicodebuf = length ? LALLOC_MULT(WCHAR, length) : NULL;
unibuflen = unibuflen ? 0 : length;
- } while(1);
+ } while (TRUE);
cells = mb_string2cells(pchBuf, cbToWrite);
}
else // cbToWrite == 1 && *pchBuf == ' ' && enc_utf8
diff --git a/src/regexp_nfa.c b/src/regexp_nfa.c
index 406a0e449..b7bfc86c0 100644
--- a/src/regexp_nfa.c
+++ b/src/regexp_nfa.c
@@ -3822,7 +3822,7 @@ post2nfa(int *postfix, int *end, int nfa_calc_size)
} // switch(*p)
- } // for(p = postfix; *p; ++p)
+ } // for (p = postfix; *p; ++p)
if (nfa_calc_size == TRUE)
{
diff --git a/src/testdir/test_codestyle.vim b/src/testdir/test_codestyle.vim
index ec476c038..355306349 100644
--- a/src/testdir/test_codestyle.vim
+++ b/src/testdir/test_codestyle.vim
@@ -36,6 +36,10 @@ def Test_source_files()
cursor(1, 1)
lnum = search('else\s*{', '', 0, 0, skip)
assert_equal(0, lnum, fname .. ': curly after "else"')
+
+ cursor(1, 1)
+ lnum = search('\<\(if\|while\|for\)(', '', 0, 0, skip)
+ assert_equal(0, lnum, fname .. ': missing white space after "if"/"while"/"for"')
endfor
bwipe!
diff --git a/src/version.c b/src/version.c
index 5af78a53c..1745dcd03 100644
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1529,
+/**/
1528,
/**/
1527,