From bac91ef9338e977cb58770cf7bd79acf4eef11f3 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 15 Mar 2026 13:51:35 +0100 Subject: [PATCH] haskellPackages.avif: use -std=gnu17 with GCC 15 avif.h will use [[nodiscard]] if the used C standard supports it. language-c and thus c2hs don't support this C23 construct yet, so we need to continue using gnu17 (which was the default with GCC 14). --- pkgs/development/haskell-modules/configuration-common.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index c0826bfa8963..fec72e288238 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1993,6 +1993,14 @@ with haskellLib; }) ] super.moto; + # c2hs/language-c don't support C23 [[nodiscard]] yet: https://github.com/visq/language-c/issues/107. + # To work around this, we tell the preprocessor of GCC 15 to use an older standard (the GCC 14 default). + avif = + if pkgs.stdenv.hasCC && pkgs.stdenv.cc.isGNU then + appendConfigureFlags [ "--c2hs-options=--cppopts=-std=gnu17" ] super.avif + else + super.avif; + # Readline uses Distribution.Simple from Cabal 2, in a way that is not # compatible with Cabal 3. No upstream repository found so far readline = appendPatch ./patches/readline-fix-for-cabal-3.patch super.readline;