GCC 15 defaults to -std=c23. In C23 "int foo ()" is equivalent to
declaring "int foo (void)". In previous version of C that declared a
function with an unknown number of arguments of an unknown type. This
results in compiler errors like the following:
progmailer.c: In function 'mu_progmailer_create':
progmailer.c:63:18: error: assignment to 'void (*)(void)' from incompatible
pointer type 'void (*)(int)' [-Wincompatible-pointer-types]
63 | pm->sighandler = SIG_ERR;
| ^
progmailer.c: In function 'mu_progmailer_open':
progmailer.c:116:23: error: assignment to 'void (*)(void)' from
incompatible pointer type '__sighandler_t' {aka 'void (*)(int)'}
[-Wincompatible-pointer-types]
116 | if ((pm->sighandler = signal (SIGCHLD, SIG_DFL)) == SIG_ERR)
| ^
In file included from progmailer.c:27:
/usr/include/signal.h:72:16: note: '__sighandler_t' declared here
72 | typedef void (*__sighandler_t) (int);
| ^~~~~~~~~~~~~~
progmailer.c:116:52: warning: comparison of distinct pointer types lacks a
cast [-Wcompare-distinct-pointer-types]
116 | if ((pm->sighandler = signal (SIGCHLD, SIG_DFL)) == SIG_ERR)
I have attached a patch to fix those.
Collin
>From e58e8b336861b9978903fdd20e254bc8309e8364 Mon Sep 17 00:00:00 2001
Message-ID: <e58e8b336861b9978903fdd20e254bc8309e8364.1765601307.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Fri, 12 Dec 2025 20:43:03 -0800
Subject: [PATCH] Fix build with GCC 15.
* libmailutils/mailer/progmailer.c (struct _mu_progmailer): Convert to a
function prototype.
* mh/scan.c (clear_screen): Likewise.
---
libmailutils/mailer/progmailer.c | 2 +-
mh/scan.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libmailutils/mailer/progmailer.c b/libmailutils/mailer/progmailer.c
index c61c917e3..7afe3b662 100644
--- a/libmailutils/mailer/progmailer.c
+++ b/libmailutils/mailer/progmailer.c
@@ -45,7 +45,7 @@ struct _mu_progmailer
{
int fd;
pid_t pid;
- void (*sighandler)();
+ void (*sighandler)(int);
char *command;
};
diff --git a/mh/scan.c b/mh/scan.c
index 8858e128e..0a49ecd91 100644
--- a/mh/scan.c
+++ b/mh/scan.c
@@ -200,7 +200,7 @@ clear_screen (void)
char *clr = tgetstr ("cl", &buffer);
if (clr)
{
- tputs(clr, 1, (int (*)())putstdout);
+ tputs(clr, 1, (int (*)(int))putstdout);
return;
}
}
--
2.52.0