From: Muraoka Taro Date: Wed, 22 Jul 2026 19:18:03 +0000 (+0000) Subject: patch 9.2.0835: features in version.c are not sorted X-Git-Tag: v9.2.0835^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=34fad27b552e90df5555d8b3b17fd40153259679;p=thirdparty%2Fvim.git patch 9.2.0835: features in version.c are not sorted Problem: features in version.c are not sorted Solution: Sort features case-insensitively (Taro Muraoka) closes: #20717 Signed-off-by: Muraoka Taro Signed-off-by: Christian Brabandt --- diff --git a/src/testdir/test_version.vim b/src/testdir/test_version.vim index 40e5192b63..ce9db1f070 100644 --- a/src/testdir/test_version.vim +++ b/src/testdir/test_version.vim @@ -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 diff --git a/src/version.c b/src/version.c index 3a7cc8698f..ac615f9b9a 100644 --- a/src/version.c +++ b/src/version.c @@ -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, /**/