From 8bde04060ae8baf4103ba25f5d8a50a13051b2c9 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Sat, 3 Jun 2023 17:52:34 -0400 Subject: [PATCH] doctest: fix build with clang 16 Clang 16 adds a buffer hardening mode as a new warning. doctest enables all warnings and promotes them to errors, which causes the build to fail with clang 16. The upstream PR suppresses these warnings on clang 16. Background: https://discourse.llvm.org/t/rfc-c-buffer-hardening/65734 --- pkgs/development/libraries/doctest/default.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/doctest/default.nix b/pkgs/development/libraries/doctest/default.nix index 7595eae7d47d..642cfa3052f7 100644 --- a/pkgs/development/libraries/doctest/default.nix +++ b/pkgs/development/libraries/doctest/default.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, installShellFiles, cmake }: +{ lib, stdenv, fetchFromGitHub, fetchpatch, installShellFiles, cmake }: stdenv.mkDerivation rec { pname = "doctest"; @@ -11,6 +11,15 @@ stdenv.mkDerivation rec { sha256 = "sha256-hotO6QVpPn8unYTaQHFgi40A3oLUd++I3aTe293e4Aw="; }; + patches = [ + # Suppress unsafe buffer usage warnings with clang 16, which are treated as errors due to `-Werror`. + # https://github.com//doctest/doctest/pull/768 + (fetchpatch { + url = "https://github.com/doctest/doctest/commit/9336c9bd86e3fc2e0c36456cad8be3b4e8829a22.patch"; + hash = "sha256-ZFCVk5qvgfixRm7ZFr7hyNCSEvrT6nB01G/CBshq53o="; + }) + ]; + nativeBuildInputs = [ cmake ]; doCheck = true;