community/libstrophe: fix gcc15 build

This commit is contained in:
Leon White 2025-09-22 17:51:12 +02:00 committed by mio
parent 4e2d636d2e
commit d15e6027ec
2 changed files with 59 additions and 2 deletions

View File

@ -1,14 +1,17 @@
# Maintainer: j.r <j.r@jugendhacker.de>
pkgname=libstrophe
pkgver=0.14.0
pkgrel=0
pkgrel=1
pkgdesc="Simple, lightweight C library for writing XMPP clients"
url="https://strophe.im/libstrophe/"
arch="all"
license="GPL-3.0-only MIT"
makedepends="expat-dev openssl-dev>3 zlib-dev"
subpackages="$pkgname-dev"
source="https://github.com/strophe/libstrophe/releases/download/$pkgver/libstrophe-$pkgver.tar.gz"
source="
https://github.com/strophe/libstrophe/releases/download/$pkgver/libstrophe-$pkgver.tar.gz
gcc-15.patch
"
prepare() {
default_prepare
@ -36,4 +39,5 @@ package() {
sha512sums="
9c1c82e83518f0e4ebaa28d5fb7c6f3f97326d2c7f21e1caa79126ff93b0095dd8a5b3ebe75084b1678a1734a6eedb4d5a5d524c1f00ab09f2225851fd6ccc2d libstrophe-0.14.0.tar.gz
ef622617f68aa87cc379e5312baa2a02ef8057f311ab1d9215ffa2765d32f5d3f5374eca15bfd98bd947a76290f32ebf831d89e54098b690c9014c0919ca1159 gcc-15.patch
"

View File

@ -0,0 +1,53 @@
From dfb3e868248d86fc0f5553dffbb6f7c367c3c383 Mon Sep 17 00:00:00 2001
From: Steffen Jaeckel <s@jaeckel.eu>
Date: Wed, 26 Mar 2025 14:14:19 +0100
Subject: [PATCH] Use `void*` to store function pointer when compiled as C23.
[0] decided that `rettype (*foo)();` must now be interpreted as
`rettype (*foo)(void);`. Luckily it also allows now to store function
pointers in a `void*` (c.f. Ch. J.5.7).
[0]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3096.pdf
Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
---
src/common.h | 7 ++++++-
src/handler.c | 2 --
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/common.h b/src/common.h
index 75134bea..c387c0fe 100644
--- a/src/common.h
+++ b/src/common.h
@@ -30,12 +30,17 @@
#include "snprintf.h"
/** handlers **/
+#if (__STDC_VERSION__ >= 202000L)
+typedef void* xmpp_void_handler;
+#else
+typedef int (*xmpp_void_handler)();
+#endif
typedef struct _xmpp_handlist_t xmpp_handlist_t;
struct _xmpp_handlist_t {
/* common members */
int user_handler;
- int (*handler)();
+ xmpp_void_handler handler;
void *userdata;
int enabled; /* handlers are added disabled and enabled after the
* handler chain is processed to prevent stanzas from
diff --git a/src/handler.c b/src/handler.c
index 1c9bf9f7..05772522 100644
--- a/src/handler.c
+++ b/src/handler.c
@@ -25,8 +25,6 @@
#include "common.h"
#include "ostypes.h"
-typedef int (*xmpp_void_handler)();
-
/* Remove item from the list pointed by head, but don't free it.
* There can be a situation when user's handler deletes another handler which
* is the previous in the list. handler_fire_stanza() and handler_fire_timed()