[vim/vim] Add support for #elifdef and #elifndef to c.vim (Issue #13667)

31 views
Skip to first unread message

Jonathan Wakely

unread,
Dec 11, 2023, 5:17:25 PM12/11/23
to vim/vim, Subscribed

The new C2x and C++23 standards add new preprocessing conditionals, #elifdef and #elifndef

For C the proposal was:
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2645.pdf

For C++ the proposal was:
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2334r1.pdf

They've been supported by GCC for a couple of years:
https://gcc.gnu.org/gcc-12/changes.html#c

Vim does not recognize these and so doesn't syntax highlight them.

#ifdef foo
#elifdef bar
#elifndef baz
#endif


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667@github.com>

Christian Brabandt

unread,
Dec 12, 2023, 11:05:32 AM12/12/23
to vim/vim, Subscribed

can you create a PR to runtime/syntax/c.vim ?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667/1852337345@github.com>

Jonathan Wakely

unread,
Dec 13, 2023, 5:23:00 AM12/13/23
to vim/vim, Subscribed

Done, but see my comment on #13679 about whether the PR is complete or not.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667/1853642662@github.com>

S. B. Tam

unread,
Jan 12, 2024, 12:41:54 AM1/12/24
to vim/vim, Subscribed

The matchit plugin also needs to recognize #elifdef and #elifndef.

https://github.com/vim/vim/blob/71d0ba07a33a750e9834cd42b7acc619043dedb1/runtime/pack/dist/opt/matchit/autoload/matchit.vim#L91-L92

The built-in [#, ]# and % do not need any change, even though they deal with #if/#else/#endif, because they only look for el and do not care about subsequent characters.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667/1888468046@github.com>

dkearns

unread,
Jan 12, 2024, 12:59:13 AM1/12/24
to vim/vim, Subscribed

I'll add it to #12984, thanks.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667/1888481283@github.com>

Christian Brabandt

unread,
Jan 13, 2024, 11:36:39 AM1/13/24
to vim/vim, Subscribed

Closed #13667 as completed via chrisbra/matchit#41.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issue/13667/issue_event/11478416551@github.com>

Jonathan Wakely

unread,
Jan 13, 2024, 12:08:45 PM1/13/24
to vim/vim, Subscribed

Marvellous, thank you!


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/13667/1890595314@github.com>

Reply all
Reply to author
Forward
0 new messages