patch 9.1.1081: has('bsd') is true for GNU/Hurd
Problem: has('bsd') is true for GNU/Hurd
Solution: exclude GNU/Hurd from BSD feature flag
(Zhaoming Luo)
GNU/Hurd, like Mac OS X, is a BSD-based system. It should exclude
has('bsd') feature just like what Mac OS X does. The __GNU__ pre-defined
macro indicates it's compiled for GNU/Hurd.
closes: #16580
Signed-off-by: Zhaoming Luo <zhmingluo@163.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/runtime/doc/builtin.txt b/runtime/doc/builtin.txt
index 39ff14e..e2d2f43 100644
--- a/runtime/doc/builtin.txt
+++ b/runtime/doc/builtin.txt
@@ -1,4 +1,4 @@
-*builtin.txt* For Vim version 9.1. Last change: 2025 Feb 02
+*builtin.txt* For Vim version 9.1. Last change: 2025 Feb 06
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -12750,6 +12750,7 @@
haiku Haiku version of Vim.
hangul_input Compiled with Hangul input support. |hangul|
hpux HP-UX version of Vim.
+hurd GNU/Hurd version of Vim
iconv Can use iconv() for conversion.
insert_expand Compiled with support for CTRL-X expansion commands in
Insert mode. (always true)
diff --git a/src/evalfunc.c b/src/evalfunc.c
index 69b6a4f..5592471 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -6425,7 +6425,7 @@
#endif
},
{"bsd",
-#if defined(BSD) && !defined(MACOS_X)
+#if defined(BSD) && !defined(MACOS_X) && !defined(__GNU__)
1
#else
0
@@ -6438,6 +6438,13 @@
0
#endif
},
+ {"hurd",
+#ifdef __GNU__
+ 1
+#else
+ 0
+#endif
+ },
{"linux",
#ifdef __linux__
1
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 5783c7a..8ecc3a6 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2888,6 +2888,7 @@
" Is Unix?
call assert_equal(has('bsd'), has('bsd') && has('unix'))
call assert_equal(has('hpux'), has('hpux') && has('unix'))
+ call assert_equal(has('hurd'), has('hurd') && has('unix'))
call assert_equal(has('linux'), has('linux') && has('unix'))
call assert_equal(has('mac'), has('mac') && has('unix'))
call assert_equal(has('qnx'), has('qnx') && has('unix'))
@@ -2905,6 +2906,7 @@
call assert_equal(uname =~? 'QNX', has('qnx'))
call assert_equal(uname =~? 'SunOS', has('sun'))
call assert_equal(uname =~? 'CYGWIN\|MSYS', has('win32unix'))
+ call assert_equal(uname =~? 'GNU', has('hurd'))
endif
endfunc
diff --git a/src/version.c b/src/version.c
index d8e8c0e..55cbd4f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1081,
+/**/
1080,
/**/
1079,