0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.3876: 'cindent' does not recognize inline namespace

Problem:    'cindent' does not recognize inline namespace.
Solution:   Skip over "inline" to find "namespace". (closes #9383)
This commit is contained in:
zeertzjq
2021-12-22 20:55:30 +00:00
committed by Bram Moolenaar
parent b4168fd917
commit f2f0bddf30
3 changed files with 54 additions and 0 deletions

View File

@@ -755,6 +755,10 @@ cin_is_cpp_namespace(char_u *s)
int has_name_start = FALSE; int has_name_start = FALSE;
s = cin_skipcomment(s); s = cin_skipcomment(s);
if (STRNCMP(s, "inline", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6])))
s = cin_skipcomment(skipwhite(s + 6));
if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9])))
{ {
p = cin_skipcomment(skipwhite(s + 9)); p = cin_skipcomment(skipwhite(s + 9));

View File

@@ -996,6 +996,15 @@ func Test_cindent_1()
22222222222222222; 22222222222222222;
} }
} }
inline namespace {
111111111111111111;
}
inline /* test */ namespace {
111111111111111111;
}
inline/* test */namespace {
111111111111111111;
}
/* invalid namespaces use block indent */ /* invalid namespaces use block indent */
namespace test test2 { namespace test test2 {
@@ -1019,6 +1028,9 @@ func Test_cindent_1()
{ {
111111111111111111; 111111111111111111;
} }
inlinenamespace {
111111111111111111;
}
void getstring() { void getstring() {
/* Raw strings */ /* Raw strings */
@@ -1961,6 +1973,15 @@ func Test_cindent_1()
22222222222222222; 22222222222222222;
} }
} }
inline namespace {
111111111111111111;
}
inline /* test */ namespace {
111111111111111111;
}
inline/* test */namespace {
111111111111111111;
}
/* invalid namespaces use block indent */ /* invalid namespaces use block indent */
namespace test test2 { namespace test test2 {
@@ -1984,6 +2005,9 @@ func Test_cindent_1()
{ {
111111111111111111; 111111111111111111;
} }
inlinenamespace {
111111111111111111;
}
void getstring() { void getstring() {
/* Raw strings */ /* Raw strings */
@@ -4358,6 +4382,15 @@ func Test_cindent_47()
22222222222222222; 22222222222222222;
} }
} }
inline namespace {
111111111111111111;
}
inline /* test */ namespace {
111111111111111111;
}
inline/* test */namespace {
111111111111111111;
}
/* invalid namespaces use block indent */ /* invalid namespaces use block indent */
namespace test test2 { namespace test test2 {
@@ -4381,6 +4414,9 @@ func Test_cindent_47()
{ {
111111111111111111; 111111111111111111;
} }
inlinenamespace {
111111111111111111;
}
NAMESPACEEND NAMESPACEEND
[CODE] [CODE]
@@ -4449,6 +4485,15 @@ func Test_cindent_47()
22222222222222222; 22222222222222222;
} }
} }
inline namespace {
111111111111111111;
}
inline /* test */ namespace {
111111111111111111;
}
inline/* test */namespace {
111111111111111111;
}
/* invalid namespaces use block indent */ /* invalid namespaces use block indent */
namespace test test2 { namespace test test2 {
@@ -4472,6 +4517,9 @@ func Test_cindent_47()
{ {
111111111111111111; 111111111111111111;
} }
inlinenamespace {
111111111111111111;
}
NAMESPACEEND NAMESPACEEND
[CODE] [CODE]

View File

@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3876,
/**/ /**/
3875, 3875,
/**/ /**/