]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0835: features in version.c are not sorted v9.2.0835
authorMuraoka Taro <koron.kaoriya@gmail.com>
Wed, 22 Jul 2026 19:18:03 +0000 (19:18 +0000)
committerChristian Brabandt <cb@256bit.org>
Wed, 22 Jul 2026 19:18:03 +0000 (19:18 +0000)
Problem:  features in version.c are not sorted
Solution: Sort features case-insensitively (Taro Muraoka)

closes: #20717

Signed-off-by: Muraoka Taro <koron.kaoriya@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/testdir/test_version.vim
src/version.c

index 40e5192b6381e4fe05bed864f407cf9456aacf28..ce9db1f070d0386ed564ca110d405951433a5efc 100644 (file)
@@ -20,4 +20,31 @@ func Test_version_redirect()
   call delete('Xversion')
 endfunc
 
+" The features[] array in version.c must stay sorted.
+func Test_features_sorted()
+  let lines = readfile('../version.c')
+  let start = match(lines, '^static char \*(features\[\]) =')
+  call assert_notequal(-1, start)
+  let end = match(lines, '^};', start)
+  call assert_notequal(-1, end)
+
+  " Alternatives for a single slot (#if/#elif/#else chains): only one of
+  " each group is ever compiled, so they are not separate list positions.
+  let ignore = ['dialog_con', 'dialog_gui', 'dialog', 'multi_byte', 'xpm', 'xsmp']
+
+  let names = []
+  for line in lines[start : end]
+    let name = matchstr(line, '"[+-]\zs[A-Za-z_0-9]\+\ze\%(/dyn\)\=",')
+    if name == '' || index(ignore, name) >= 0
+      continue
+    endif
+    if empty(names) || names[-1] !=# name
+      call add(names, name)
+    endif
+  endfor
+
+  call assert_true(len(names) > 100)
+  call assert_equal(sort(copy(names), 'i'), names)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 3a7cc8698f979d65e2c6de0d84b3caf15e5d54a7..ac615f9b9a71a6ef704d9d56649680eb0a0d9fef 100644 (file)
@@ -96,6 +96,11 @@ static char *(features[]) =
 #else
        "-acl",
 #endif
+#ifdef FEAT_ARABIC
+       "+arabic",
+#else
+       "-arabic",
+#endif
 #ifdef AMIGA           // only for Amiga systems
 # ifdef FEAT_ARP
        "+ARP",
@@ -103,17 +108,12 @@ static char *(features[]) =
        "-ARP",
 # endif
 #endif
-#ifdef FEAT_ARABIC
-       "+arabic",
-#else
-       "-arabic",
-#endif
-       "+autocmd",
 #ifdef FEAT_AUTOCHDIR
-       "+autochdir",
+       "+autochdir",
 #else
-       "-autochdir",
+       "-autochdir",
 #endif
+       "+autocmd",
 #ifdef FEAT_AUTOSERVERNAME
        "+autoservername",
 #else
@@ -274,6 +274,36 @@ static char *(features[]) =
 # endif
 #else
        "-iconv",
+#endif
+#ifdef FEAT_IMAGE
+       "+image",
+#else
+       "-image",
+#endif
+#ifdef FEAT_IMAGE_CAIRO
+       "+image_cairo",
+#else
+       "-image_cairo",
+#endif
+#ifdef FEAT_IMAGE_GDI
+       "+image_gdi",
+#else
+       "-image_gdi",
+#endif
+#ifdef FEAT_IMAGE_GDK
+       "+image_gdk",
+#else
+       "-image_gdk",
+#endif
+#ifdef FEAT_IMAGE_KITTY
+       "+image_kitty",
+#else
+       "-image_kitty",
+#endif
+#ifdef FEAT_IMAGE_SIXEL
+       "+image_sixel",
+#else
+       "-image_sixel",
 #endif
        "+insert_expand",
 #ifdef FEAT_IPV6
@@ -336,12 +366,6 @@ static char *(features[]) =
 #endif
        "+modify_fname",
        "+mouse",
-#ifdef FEAT_MOUSESHAPE
-       "+mouseshape",
-#else
-       "-mouseshape",
-#endif
-
 #if defined(UNIX) || defined(VMS)
 # ifdef FEAT_MOUSE_DEC
        "+mouse_dec",
@@ -391,6 +415,11 @@ static char *(features[]) =
 # endif
        "+mouse_xterm",
 #endif
+#ifdef FEAT_MOUSESHAPE
+       "+mouseshape",
+#else
+       "-mouseshape",
+#endif
 
 #ifdef FEAT_MBYTE_IME
 # ifdef DYNAMIC_IME
@@ -535,36 +564,6 @@ static char *(features[]) =
 #else
        "-sodium",
 #endif
-#ifdef FEAT_IMAGE
-       "+image",
-#else
-       "-image",
-#endif
-#ifdef FEAT_IMAGE_SIXEL
-       "+image_sixel",
-#else
-       "-image_sixel",
-#endif
-#ifdef FEAT_IMAGE_KITTY
-       "+image_kitty",
-#else
-       "-image_kitty",
-#endif
-#ifdef FEAT_IMAGE_GDI
-       "+image_gdi",
-#else
-       "-image_gdi",
-#endif
-#ifdef FEAT_IMAGE_CAIRO
-       "+image_cairo",
-#else
-       "-image_cairo",
-#endif
-#ifdef FEAT_IMAGE_GDK
-       "+image_gdk",
-#else
-       "-image_gdk",
-#endif
 #ifdef FEAT_SOUND
        "+sound",
 #else
@@ -600,9 +599,9 @@ static char *(features[]) =
 #else
        "-tabpanel",
 #endif
+       "-tag_any_white",
        "+tag_binary",
        "-tag_old_static",
-       "-tag_any_white",
 #ifdef FEAT_TCL
 # ifdef DYNAMIC_TCL
        "+tcl/dyn",
@@ -759,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    835,
 /**/
     834,
 /**/