commit:     352d9e97e70837f065c981ad3ff61520a6f92be3
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Nov 25 23:25:37 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Nov 25 23:27:33 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=352d9e97

app-misc/vifm: fix C23 compat

Closes: https://bugs.gentoo.org/944197
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-misc/vifm/files/vifm-0.13-c23.patch | 46 +++++++++++++++++++++++++++++++++
 app-misc/vifm/vifm-0.13-r1.ebuild       |  4 ++-
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/app-misc/vifm/files/vifm-0.13-c23.patch 
b/app-misc/vifm/files/vifm-0.13-c23.patch
new file mode 100644
index 000000000000..b8d5e97835ff
--- /dev/null
+++ b/app-misc/vifm/files/vifm-0.13-c23.patch
@@ -0,0 +1,46 @@
+https://bugs.gentoo.org/944197
+https://github.com/vifm/vifm/commit/a31fcbb13a1a52fecff5f5ebaa9ea2d23c059edf
+
+From a31fcbb13a1a52fecff5f5ebaa9ea2d23c059edf Mon Sep 17 00:00:00 2001
+From: Sergei Trofimovich <[email protected]>
+Date: Mon, 18 Nov 2024 06:50:44 +0000
+Subject: [PATCH] src/int/term_title.c: : fix build against -std=c23 (`void
+ (*)()`) changed the meaning)
+
+gcc-15 switched to -std=c23 by default:
+
+    
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
+
+As a result `vifm` fails the build as:
+
+    int/term_title.c: In function 'get_x11_window_title':
+    int/term_title.c:364:21: error:
+      assignment to 'int (*)(void)' from incompatible pointer type 
'XErrorHandler' {aka 'int (*)(Display *, XErrorEvent *)'} 
[-Wincompatible-pointer-types-Wincompatible-pointer-types]
+      364 |         old_handler = XSetErrorHandlerWrapper(x_error_check);
+          |                     ^
+    int/term_title.c:367:47: error:
+      passing argument 1 of 'XSetErrorHandlerWrapper' from incompatible 
pointer type [-Wincompatible-pointer-types]
+      367 |                 (void)XSetErrorHandlerWrapper(old_handler);
+          |                                               ^~~~~~~~~~~
+          |                                               |
+          |                                               int (*)(void)
+
+The changes fully specifies `old_handler` type.
+---
+ src/int/term_title.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/int/term_title.c b/src/int/term_title.c
+index 17327632d..202ca5a9e 100644
+--- a/src/int/term_title.c
++++ b/src/int/term_title.c
+@@ -358,7 +358,7 @@ get_x11_disp_and_win(Display **disp, Window *win)
+ static void
+ get_x11_window_title(Display *disp, Window win, char *buf, size_t buf_len)
+ {
+-      int (*old_handler)();
++      int (*old_handler)(Display *, XErrorEvent *);
+       XTextProperty text_prop;
+ 
+       old_handler = XSetErrorHandlerWrapper(x_error_check);
+

diff --git a/app-misc/vifm/vifm-0.13-r1.ebuild 
b/app-misc/vifm/vifm-0.13-r1.ebuild
index 1a7971e162cd..85b7cfa80ce5 100644
--- a/app-misc/vifm/vifm-0.13-r1.ebuild
+++ b/app-misc/vifm/vifm-0.13-r1.ebuild
@@ -34,9 +34,11 @@ RDEPEND="
 BDEPEND="|| ( dev-lang/perl app-editors/vim )"
 
 PATCHES=(
-       # Bacported fix from upstream,
+       # Backported fix from upstream,
        # see also https://github.com/vifm/vifm/issues/913
        "${FILESDIR}/${P}-musl.patch"
+       # https://github.com/vifm/vifm/pull/1035
+       "${FILESDIR}/${P}-c23.patch"
 )
 
 src_prepare() {

Reply via email to