From 9902e051dbad5f4a7f5bf17580d2b2fba63e6c1d Mon Sep 17 00:00:00 2001 From: David Laing Date: Thu, 1 Jan 2026 16:46:03 +0000 Subject: [PATCH] gnucobol: fix build with GCC 15 GCC 15 changed some warnings to errors, particularly around function pointer types (C23 empty parentheses means no args, not unspecified). These flags are needed until gnucobol is updated to compile cleanly with GCC 15. See: https://gcc.gnu.org/gcc-15/porting_to.html --- pkgs/by-name/gn/gnucobol/package.nix | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/gn/gnucobol/package.nix b/pkgs/by-name/gn/gnucobol/package.nix index 76231551ccc7..a4d5cf34a611 100644 --- a/pkgs/by-name/gn/gnucobol/package.nix +++ b/pkgs/by-name/gn/gnucobol/package.nix @@ -91,9 +91,23 @@ stdenv.mkDerivation (finalAttrs: { substituteInPlace configure --replace-fail '"GNU strip"' 'FAKE GNU strip' ''; - # error: call to undeclared function 'xmlCleanupParser' - # ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] - env.CFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin "-Wno-error=implicit-function-declaration"; + # GCC 15 changed some warnings to errors, particularly around function pointer types + # (C23 empty parentheses means no args, not unspecified). These flags are needed + # until gnucobol is updated to compile cleanly with GCC 15. + # See: https://gcc.gnu.org/gcc-15/porting_to.html + env.CFLAGS = + let + # Clang needs -Wno-error=implicit-function-declaration for xmlCleanupParser + clangFlags = "-Wno-error=implicit-function-declaration"; + # GCC 15+ needs additional flags for incompatible pointer type errors + gcc15Flags = "-Wno-error=incompatible-pointer-types -std=gnu11"; + in + if stdenv.cc.isGNU && lib.versionAtLeast stdenv.cc.version "15.0.0" then + gcc15Flags + else if stdenv.cc.isClang then + clangFlags + else + ""; enableParallelBuilding = true;