From: Foxe Chen Date: Mon, 27 Jul 2026 20:28:31 +0000 (+0000) Subject: patch 9.2.0864: Using some dead code in Wayland feature X-Git-Tag: v9.2.0864^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32bc32c974a455f2d678c72bb270e93241998258;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/auto/configure b/src/auto/configure index f5d6dea01c..ffdff96628 100755 --- a/src/auto/configure +++ b/src/auto/configure @@ -9177,37 +9177,6 @@ fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $enable_fontset" >&5 printf "%s\n" "$enable_fontset" >&6; } -{ printf "%s\n" "$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 - #include - #include -int -main (void) -{ -shm_open("/test", O_CREAT, 0600); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO" -then : - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -printf "%s\n" "yes" >&6; }; printf "%s\n" "#define HAVE_SHM_OPEN 1" >>confdefs.h - -else case e in #( - e) { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 -printf "%s\n" "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\n" "$as_me:${as_lineno-$LINENO}: checking --with-wayland argument" >&5 printf %s "checking --with-wayland argument... " >&6; } @@ -9269,6 +9238,9 @@ printf "%s\n" "no" >&6; } fi CPPFLAGS=$cppflags_save CFLAGS=$cflags_save +else + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 +printf "%s\n" "no" >&6; } fi if test "x$enable_gui" = "xgtk4"; then diff --git a/src/config.h.in b/src/config.h.in index 7861329897..bb16501ead 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 b71e553394..0cf75308be 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 - #include - #include ], [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 85b4353c43..5a6ccacc9c 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 -# include -# include -#endif - #ifdef USE_XSMP # include #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 aca289d1f7..69e620b981 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 e5dfd3eaa3..6921752476 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, /**/