[vim/vim] Initialise di_key at compile time (PR #20185)

5 views
Skip to first unread message

John Marriott

unread,
May 10, 2026, 6:16:08 PM (18 hours ago) May 10
to vim/vim, Subscribed

This PR initialises the di_key struct member (in struct dictitem16_T which itself is inside struct vimvar) at compile time.

This means we can drop the length test and the string copy in evalvars_init(). The compiler will truncate the string if it is too long and will give a warning if -Wexcess-initializers is set like so (from clang 22.1.4):

evalvars.c:54:14: warning: initializer-string for char array is too long [-Wexcess-initializers]
   54 |     {VV_NAME("count0000000000000000",            VAR_NUMBER), NULL, VV_COMPAT+VV_RO},
      |              ^~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

Cheers
John


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/20185

Commit Summary

  • 86adad1 Initialise di_key at compile time

File Changes

(1 file)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20185@github.com>

Christian Brabandt

unread,
4:35 AM (7 hours ago) 4:35 AM
to vim/vim, Subscribed
chrisbra left a comment (vim/vim#20185)

Thanks, is this warning a default? Okay, I just tested with gcc-15 and clang-21 and I can see a warning being emitted by either one without any specific arguments. Good, thanks


Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/20185/c4418869902@github.com>

Reply all
Reply to author
Forward
0 new messages