From 4204cb57715b8d505403656523bbcee8af6e6162 Mon Sep 17 00:00:00 2001 From: Justin Chen <42143810+StarryReverie@users.noreply.github.com> Date: Sat, 3 Jan 2026 00:13:32 +0800 Subject: [PATCH] gforth: fix build with GCC 15 --- pkgs/by-name/gf/gforth/boot-forth.nix | 5 ++++ .../by-name/gf/gforth/function-pointers.patch | 26 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/by-name/gf/gforth/function-pointers.patch diff --git a/pkgs/by-name/gf/gforth/boot-forth.nix b/pkgs/by-name/gf/gforth/boot-forth.nix index 13c0cd5955e2..5451e7d56382 100644 --- a/pkgs/by-name/gf/gforth/boot-forth.nix +++ b/pkgs/by-name/gf/gforth/boot-forth.nix @@ -16,6 +16,11 @@ stdenv.mkDerivation { sha256 = "1c1bahc9ypmca8rv2dijiqbangm1d9av286904yw48ph7ciz4qig"; }; + patches = [ + # Newer GCC rejects casting between function pointers omitting parameters + ./function-pointers.patch + ]; + buildInputs = [ m4 ]; configureFlags = lib.optionals stdenv.hostPlatform.isDarwin [ "--build=x86_64-apple-darwin" ]; diff --git a/pkgs/by-name/gf/gforth/function-pointers.patch b/pkgs/by-name/gf/gforth/function-pointers.patch new file mode 100644 index 000000000000..77311c0514f8 --- /dev/null +++ b/pkgs/by-name/gf/gforth/function-pointers.patch @@ -0,0 +1,26 @@ +diff --git a/engine/signals.c b/engine/signals.c +index b522f19..7f89bcd 100644 +--- a/engine/signals.c ++++ b/engine/signals.c +@@ -399,7 +399,7 @@ void install_signal_handlers(void) + #endif + }; + int i; +- void (*throw_handler)() = die_on_signal ? graceful_exit : signal_throw; ++ void (*throw_handler)(int) = die_on_signal ? graceful_exit : signal_throw; + #ifdef SIGSTKSZ + stack_t sigstack; + int sas_retval=-1; +diff --git a/engine/support.c b/engine/support.c +index 021fa22..069c32f 100644 +--- a/engine/support.c ++++ b/engine/support.c +@@ -79,7 +79,7 @@ char *tilde_cstr(Char *from, UCell size, int clear) + { + char *s1,*s2; + int s1_len, s2_len; +- struct passwd *getpwnam (), *user_entry; ++ struct passwd *getpwnam (const char *), *user_entry; + + if (size<1 || from[0]!='~') + return cstr(from, size, clear);