:syntax onset syntax=c)struct timespec get highlighted as errorsThe braces shouldn't get highlighted. I can work around it with let g:no_curly_error = 1, but ideally I wouldn't need that.
9.1, Included patches: 1-948, 950, 1230-1242, 1244
tested with vim -u NONE on Debian 13.1, the exact package version is 2:9.1.1230-2
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I'm surprised this doesn't hit people all the time. Maybe everyone disables the error highlighting?
Something like the following might be sufficient but I have given it very little thought:
diff --git a/runtime/syntax/c.vim b/runtime/syntax/c.vim index 68b6778c7..3943dbdc1 100644 --- a/runtime/syntax/c.vim +++ b/runtime/syntax/c.vim @@ -173,7 +173,7 @@ elseif exists("c_no_bracket_error") " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cParen,cString,@Spell syn match cParenError display ")" - syn match cErrInParen display contained "[{}]\|<%\|%>" + syn match cErrInParen display contained "\%()\s*\)\@<!{\|[}]\|<%\|%>" endif else if s:in_cpp_family && !exists("cpp_no_cpp11") @@ -188,7 +188,7 @@ else " cCppParen: same as cParen but ends at end-of-line; used in cDefine syn region cCppParen transparent start='(' skip='\\$' excludenl end=')' end='$' contained contains=ALLBUT,@cParenGroup,cErrInBracket,cParen,cBracket,cString,@Spell syn match cParenError display "[\])]" - syn match cErrInParen display contained "[\]{}]\|<%\|%>" + syn match cErrInParen display contained "\%()\s*\)\@<!{\|[\]}]\|<%\|%>" syn region cBracket transparent start='\[\|<::\@!' end=']\|:>' end='}'me=s-1 contains=ALLBUT,cBlock,@cParenGroup,cErrInParen,cCppParen,cCppBracket,@cStringGroup,@Spell endif " cCppBracket: same as cParen but ends at end-of-line; used in cDefine
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Since my bug report was marked as a duplicate as this, I might as well add some relevant info here. The issue seems to be with aggregate type literals (i.e., literals of array/struct/union types) enclosed in either square brackets or parentheses. But you can't rely on the braces being preceded by a parentheses group, see the last example:
int a[(struct foo){ }.bar];
static_assert(sizeof (int []){ 1, 2, 3 } == 3 * sizeof (int));
for (struct foo i = { };;) ;
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Is anyone still checking this thread? Btw, I am @bogdan-barbu but made the PR on this account because I lost access to the email associated with that other account.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()