noreturn is now highlighted as keyword in C++ code. It should not.
https://github.com/vim/vim/pull/19170
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Are you noticing this because it's highlighting the attribute?
Most of those other C11 keywords aren't C++ either.
I think it would be a good idea to use a dedicated C++ syntax file that doesn't source the C file. A little duplication would be much easier to handle.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Are you noticing this because it's highlighting the attribute?
Yes.
Most of those other C11 keywords aren't C++ either.
Identifiers like _Noreturn and _Generic do not matter, as they are reserved. Only noreturn causes apparent problems—it is a valid identifier for user use.
Also notice that C23 is going towards the C++ direction: [[noreturn]] is recommended.
I think it would be a good idea to use a dedicated C++ syntax file that doesn't source the C file. A little duplication would be much easier to handle.
Since C and C++ standards are trying to align, and more common stuff will likely come to both languages, I think reusing the C syntax file in C++ is still OK.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
I was going to add generic attribute highlighting but I probably won't get to it before the release.
Presumably the stdatomic.h types shouldn't be matched in C++?
Could you please add a couple of simple syntax tests to check that noreturn is highlighted for C and not highlighted for C++?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I second the suggestion to add syntax tests. Have a look at this recent commit, where I added a syntext test for cpp numbers 335aecd
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I am still learning how to add syntax tests.
In the meantime, noreturn is a macro from #include <stdnoreturn.h>. So maybe it should never have been highlighted, even in C? In that case, simply removing it from c.vim is the simplest way.
Though we do have examples of highlighting stuff from includes, noreturn is not commonly used (AFAIK), and its use is deprecated anyway (in favour of [[noreturn]] in C23).
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
I know how to add tests now.
Let me know which direction to go:
noreturn from c.vim (I'll change this PR).—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()