ncompress
ncompress copied to clipboard
compress.c: fix -std=c23 build failure (signal handler protos)
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
As a result ncompress fails the build as:
compress.c: In function 'main':
compress.c:382:40: error:
passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
382 | signal(SIGINT, (SIG_TYPE)abort_compress);
| ^~~~~~~~~~~~~~~~~~~~~~~~
| |
| void (*)(void)
In file included from compress.c:30:
...-glibc-2.40-36-dev/include/signal.h:88:57: note:
expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
| ~~~~~~~~~~~~~~~^~~~~~~~~
The change removes type casts around function prototypes and define signal handler as void(*)(int).