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;