Fix invalid prototypes that will break with C23 release-2.x.y

Tue, 21 Jan 2025 10:49:29 -0600

author
Elliott Sales de Andrade <quantum.analyst@gmail.com>
date
Tue, 21 Jan 2025 10:49:29 -0600
branch
release-2.x.y
changeset 43154
10ae9c0f0cbf
parent 43153
2e4624a59df5
child 43155
624e30955003

Fix invalid prototypes that will break with C23

Using `function()` used to mean "any number" of parameters, but as of C23, this
is now aligned with C++ and means _zero_ parameters. This will cause build
failures due to mismatched function parameters in GCC15, which switched to C23
by default.

Related to PIDGIN-18028, though I guess Gentoo didn't actually have the problem as they disabled Zephyr.

Testing Done:
Compiled with GCC15 without error.

Reviewed at https://reviews.imfreedom.org/r/3776/

configure.ac file | annotate | diff | comparison | revisions
libpurple/protocols/zephyr/ZSendList.c file | annotate | diff | comparison | revisions
libpurple/protocols/zephyr/ZSendNot.c file | annotate | diff | comparison | revisions
libpurple/protocols/zephyr/zephyr_internal.h file | annotate | diff | comparison | revisions
--- a/configure.ac	Tue Jan 21 10:44:24 2025 -0600
+++ b/configure.ac	Tue Jan 21 10:49:29 2025 -0600
@@ -200,7 +200,7 @@
 #include <time.h>
 #include <stdio.h>
 
-int main()
+int main(void)
 {
 	char buf[6];
 	time_t t = time(NULL);
--- a/libpurple/protocols/zephyr/ZSendList.c	Tue Jan 21 10:44:24 2025 -0600
+++ b/libpurple/protocols/zephyr/ZSendList.c	Tue Jan 21 10:49:29 2025 -0600
@@ -18,7 +18,7 @@
 
 Code_t
 ZSrvSendList(ZNotice_t *notice, char *list[], int nitems,
-             Z_AuthProc cert_routine, Code_t (*send_routine)())
+             Z_AuthProc cert_routine, Z_SendProc send_routine)
 {
     Code_t retval;
     ZNotice_t newnotice;
--- a/libpurple/protocols/zephyr/ZSendNot.c	Tue Jan 21 10:44:24 2025 -0600
+++ b/libpurple/protocols/zephyr/ZSendNot.c	Tue Jan 21 10:49:29 2025 -0600
@@ -18,7 +18,7 @@
 
 Code_t
 ZSrvSendNotice(ZNotice_t *notice, Z_AuthProc cert_routine,
-               Code_t (*send_routine)())
+               Z_SendProc send_routine)
 {
     Code_t retval;
     ZNotice_t newnotice;
--- a/libpurple/protocols/zephyr/zephyr_internal.h	Tue Jan 21 10:44:24 2025 -0600
+++ b/libpurple/protocols/zephyr/zephyr_internal.h	Tue Jan 21 10:49:29 2025 -0600
@@ -147,6 +147,7 @@
 
 /* Defines for ZFormatNotice, et al. */
 typedef Code_t (*Z_AuthProc) ZP((ZNotice_t*, char *, int, int *));
+typedef Code_t (*Z_SendProc) ZP((ZNotice_t *, char *, int, int));
 Code_t ZMakeAuthentication ZP((ZNotice_t*, char *,int, int*));
 
 char *ZGetSender ZP((void));
@@ -163,9 +164,9 @@
 Code_t ZReadAscii16 ZP((char *, int, unsigned short *));
 Code_t ZSendPacket ZP((char*, int, int));
 Code_t ZSendList ZP((ZNotice_t*, char *[], int, Z_AuthProc));
-Code_t ZSrvSendList ZP((ZNotice_t*, char*[], int, Z_AuthProc, Code_t (*)()));
+Code_t ZSrvSendList ZP((ZNotice_t*, char*[], int, Z_AuthProc, Z_SendProc));
 Code_t ZSendNotice ZP((ZNotice_t *, Z_AuthProc));
-Code_t ZSrvSendNotice ZP((ZNotice_t*, Z_AuthProc, Code_t (*)()));
+Code_t ZSrvSendNotice ZP((ZNotice_t*, Z_AuthProc, Z_SendProc));
 Code_t ZFormatNotice ZP((ZNotice_t*, char**, int*, Z_AuthProc));
 Code_t ZFormatSmallNotice ZP((ZNotice_t*, ZPacket_t, int*, Z_AuthProc));
 Code_t ZFormatRawNoticeList ZP((ZNotice_t *notice, char *list[], int nitems,

mercurial