Commit: patch 9.2.0864: Using some dead code in Wayland feature

1 view
Skip to first unread message

Christian Brabandt

unread,
4:45 PM (5 hours ago) 4:45 PM
to vim...@googlegroups.com
patch 9.2.0864: Using some dead code in Wayland feature

Commit: https://github.com/vim/vim/commit/32bc32c974a455f2d678c72bb270e93241998258
Author: Foxe Chen <chen...@gmail.com>
Date: Mon Jul 27 20:28:31 2026 +0000

patch 9.2.0864: Using some dead code in Wayland feature

Problem: Using some dead code in Wayland feature
Solution: Cleanup configure check and remove HAVE_SHM_OPEN test, remove
mch_open_anon_file(), Show result "no" when disabling Wayland
via configure, regenerate auto/configure (Foxe Chen)

closes: #20859

Signed-off-by: Foxe Chen <chen...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/auto/configure b/src/auto/configure
index f5d6dea01..ffdff9662 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -9177,37 +9177,6 @@ fi
{ printf "%s
" "$as_me:${as_lineno-$LINENO}: result: $enable_fontset" >&5
printf "%s
" "$enable_fontset" >&6; }

-{ printf "%s
" "$as_me:${as_lineno-$LINENO}: checking if shm_open is available" >&5
-printf %s "checking if shm_open is available... " >&6; }
-cppflags_save=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/mman.h>
- #include <sys/stat.h>
- #include <fcntl.h>
-int
-main (void)
-{
-shm_open("/test", O_CREAT, 0600);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"
-then :
- { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-printf "%s
" "yes" >&6; }; printf "%s
" "#define HAVE_SHM_OPEN 1" >>confdefs.h
-
-else case e in #(
- e) { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no" >&5
-printf "%s
" "no" >&6; } ;;
-esac
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.beam \
- conftest$ac_exeext conftest.$ac_ext
-CPPFLAGS=$cppflags_save
-
{ printf "%s
" "$as_me:${as_lineno-$LINENO}: checking --with-wayland argument" >&5
printf %s "checking --with-wayland argument... " >&6; }

@@ -9269,6 +9238,9 @@ printf "%s
" "no" >&6; }
fi
CPPFLAGS=$cppflags_save
CFLAGS=$cflags_save
+else
+ { printf "%s
" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s
" "no" >&6; }
fi

if test "x$enable_gui" = "xgtk4"; then
diff --git a/src/config.h.in b/src/config.h.in
index 786132989..bb16501ea 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -514,9 +514,6 @@
/* Define if we have flock() */
#undef HAVE_FLOCK

-/* Define if we have shm_open() */
-#undef HAVE_SHM_OPEN
-
/* Define to inline symbol or empty */
#undef inline

diff --git a/src/configure.ac b/src/configure.ac
index b71e55339..0cf75308b 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -2425,17 +2425,6 @@ AC_ARG_ENABLE(fontset,
AC_MSG_RESULT($enable_fontset)
dnl defining FEAT_XFONTSET is delayed, so that it can be disabled for no GUI

-AC_MSG_CHECKING(if shm_open is available)
-cppflags_save=$CPPFLAGS
-CPPFLAGS="$CPPFLAGS $X_CFLAGS"
-AC_LINK_IFELSE([AC_LANG_PROGRAM(
- [#include <sys/mman.h>
- #include <sys/stat.h>
- #include <fcntl.h>], [shm_open("/test", O_CREAT, 0600);])],
- AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SHM_OPEN),
- AC_MSG_RESULT(no))
-CPPFLAGS=$cppflags_save
-
AC_MSG_CHECKING(--with-wayland argument)
AC_ARG_WITH(wayland,
[ --with-wayland Include support for the Wayland protocol.],
@@ -2480,6 +2469,8 @@ if test "$with_wayland" = yes; then
fi
CPPFLAGS=$cppflags_save
CFLAGS=$cflags_save
+else
+ AC_MSG_RESULT(no)
fi

dnl GTK4 does not use X11 APIs directly, so skip X11 detection entirely.
diff --git a/src/os_unix.c b/src/os_unix.c
index 85b4353c4..5a6ccacc9 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -26,12 +26,6 @@

#include "os_unixx.h" // unix includes for os_unix.c only

-#ifdef HAVE_SHM_OPEN
-# include <sys/mman.h>
-# include <sys/stat.h>
-# include <fcntl.h>
-#endif
-
#ifdef USE_XSMP
# include <X11/SM/SMlib.h>
#endif
@@ -9168,44 +9162,3 @@ start_timeout(long msec)
}
# endif // PROF_NSEC
#endif // FEAT_RELTIME
-
-/*
- * Create an anonymous/temporary file/object and return its file descriptor.
- * Returns -1 on error.
- */
- int
-mch_create_anon_file(void)
-{
- int fd = -1;
-#ifdef HAVE_SHM_OPEN
- const char template[] = "/vimXXXXXX";
-
- for (int i = 0; i < 100; i++)
- {
- mch_get_random((char_u*)template + 4, 6);
-
- errno = 0;
- fd = shm_open(template, O_CREAT | O_RDWR | O_EXCL, 0600);
-
- if (fd >= 0 || errno != EEXIST)
- break;
- }
- // Remove object name from namespace
- shm_unlink(template);
-#endif
- // Last resort
- if (fd == -1)
- {
- char_u *tempname;
- // get a name for the temp file
- if ((tempname = vim_tempname('w', FALSE)) == NULL)
- {
- emsg(_(e_cant_get_temp_file_name));
- return -1;
- }
- fd = mch_open((char *)tempname, O_CREAT | O_RDWR | O_EXCL, 0600);
- mch_remove(tempname);
- vim_free(tempname);
- }
- return fd;
-}
diff --git a/src/proto/os_unix.pro b/src/proto/os_unix.pro
index aca289d1f..69e620b98 100644
--- a/src/proto/os_unix.pro
+++ b/src/proto/os_unix.pro
@@ -95,5 +95,4 @@ void xsmp_close(void);
void stop_timeout(void);
volatile sig_atomic_t *start_timeout(long msec);
void delete_timer(void);
-int mch_create_anon_file(void);
/* vim: set ft=c : */
diff --git a/src/version.c b/src/version.c
index e5dfd3eaa..692175247 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 864,
/**/
863,
/**/
Reply all
Reply to author
Forward
0 new messages