gnucobol: fix build with GCC 15 (#475950)

This commit is contained in:
Aleksana
2026-01-05 10:26:53 +00:00
committed by GitHub
+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;