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
This commit is contained in:
David Laing
2026-01-03 23:22:23 +00:00
parent 7a414e9bf4
commit 9902e051db
+17 -3
View File
@@ -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;