vim-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: vim/vim#16580

a41dfcd55b

Co-authored-by: Zhaoming Luo <zhmingluo@163.com>
This commit is contained in:
zeertzjq
2025-02-07 06:24:17 +08:00
parent d8e191a6ab
commit 7c43f1128d
5 changed files with 9 additions and 1 deletions

View File

@@ -4597,6 +4597,7 @@ has({feature}) *has()*
fname_case Case in file names matters (for Darwin and MS-Windows fname_case Case in file names matters (for Darwin and MS-Windows
this is not present). this is not present).
gui_running Nvim has a GUI. gui_running Nvim has a GUI.
hurd GNU/Hurd system.
iconv Can use |iconv()| for conversion. iconv Can use |iconv()| for conversion.
linux Linux system. linux Linux system.
mac MacOS system. mac MacOS system.

View File

@@ -4148,6 +4148,7 @@ function vim.fn.globpath(path, expr, nosuf, list, allinks) end
--- fname_case Case in file names matters (for Darwin and MS-Windows --- fname_case Case in file names matters (for Darwin and MS-Windows
--- this is not present). --- this is not present).
--- gui_running Nvim has a GUI. --- gui_running Nvim has a GUI.
--- hurd GNU/Hurd system.
--- iconv Can use |iconv()| for conversion. --- iconv Can use |iconv()| for conversion.
--- linux Linux system. --- linux Linux system.
--- mac MacOS system. --- mac MacOS system.

View File

@@ -5119,6 +5119,7 @@ M.funcs = {
fname_case Case in file names matters (for Darwin and MS-Windows fname_case Case in file names matters (for Darwin and MS-Windows
this is not present). this is not present).
gui_running Nvim has a GUI. gui_running Nvim has a GUI.
hurd GNU/Hurd system.
iconv Can use |iconv()| for conversion. iconv Can use |iconv()| for conversion.
linux Linux system. linux Linux system.
mac MacOS system. mac MacOS system.

View File

@@ -3075,9 +3075,12 @@ static void f_gettext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) static void f_has(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
{ {
static const char *const has_list[] = { static const char *const has_list[] = {
#if defined(BSD) && !defined(__APPLE__) #if defined(BSD) && !defined(__APPLE__) && !defined(__GNU__)
"bsd", "bsd",
#endif #endif
#ifdef __GNU__
"hurd",
#endif
#ifdef __linux__ #ifdef __linux__
"linux", "linux",
#endif #endif

View File

@@ -2717,6 +2717,7 @@ func Test_platform_name()
" Is Unix? " Is Unix?
call assert_equal(has('bsd'), has('bsd') && has('unix')) call assert_equal(has('bsd'), has('bsd') && has('unix'))
call assert_equal(has('hpux'), has('hpux') && 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('linux'), has('linux') && has('unix'))
call assert_equal(has('mac'), has('mac') && has('unix')) call assert_equal(has('mac'), has('mac') && has('unix'))
call assert_equal(has('qnx'), has('qnx') && has('unix')) call assert_equal(has('qnx'), has('qnx') && has('unix'))
@@ -2734,6 +2735,7 @@ func Test_platform_name()
call assert_equal(uname =~? 'QNX', has('qnx')) call assert_equal(uname =~? 'QNX', has('qnx'))
call assert_equal(uname =~? 'SunOS', has('sun')) call assert_equal(uname =~? 'SunOS', has('sun'))
call assert_equal(uname =~? 'CYGWIN\|MSYS', has('win32unix')) call assert_equal(uname =~? 'CYGWIN\|MSYS', has('win32unix'))
call assert_equal(uname =~? 'GNU', has('hurd'))
endif endif
endfunc endfunc