Unverified Commit 2f52b154 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

gnucobol: fix build with GCC 15 (#475950)

parents 4be8cc5f 9902e051
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -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;