]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.2.0864: Using some dead code in Wayland feature v9.2.0864
authorFoxe Chen <chen.foxe@gmail.com>
Mon, 27 Jul 2026 20:28:31 +0000 (20:28 +0000)
committerChristian Brabandt <cb@256bit.org>
Mon, 27 Jul 2026 20:28:31 +0000 (20:28 +0000)
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.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/auto/configure
src/config.h.in
src/configure.ac
src/os_unix.c
src/proto/os_unix.pro
src/version.c

index f5d6dea01ca24ea5bdd2c3a076fbb772ab0c68c0..ffdff966284c3642aed1a123495f45b160138882 100755 (executable)
@@ -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 <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\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
index 78613298971285dd876395d0fa1a40bce5c85629..bb16501ead873df2daf31096af26c45c4ff32e3e 100644 (file)
 /* 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
 
index b71e553394b139b97431f10fa8ff144bb9fa5bcb..0cf75308bedfd9fe7190cf3e8680aa6ebe9a2027 100644 (file)
@@ -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.
index 85b4353c43fb9901aafe064b7b841a91bcfd68ac..5a6ccacc9cdd2d70fb55bb11c92c0b6e1ae2f1a2 100644 (file)
 
 #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;
-}
index aca289d1f75aa2c34364297e93556f66e229e8c2..69e620b98172689742d0506c47b4db9558ac6fcb 100644 (file)
@@ -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 : */
index e5dfd3eaa3715629990f4baec3b268683e247445..6921752476d187173276a23d191b98acf7180d38 100644 (file)
@@ -758,6 +758,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    864,
 /**/
     863,
 /**/