From d07541be29ba62c1cf6a83279ac3d41e9eabf839 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 23 Apr 2025 17:28:09 +0200 Subject: [PATCH] DerivationBuilder: Fix compiler warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes ../src/libstore/unix/build/derivation-builder.cc:1130:86: warning: the compiler can assume that the address of ‘nix::DerivationBuilderParams::drv’ will never be NULL [-Waddress] 1130 | if (useChroot && settings.preBuildHook != "" && dynamic_cast(&drv)) { | ^~~~ Assuming this check was left over from the time `drv` could be a `BasicDerivation`. --- src/libstore/unix/build/derivation-builder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstore/unix/build/derivation-builder.cc b/src/libstore/unix/build/derivation-builder.cc index 01e4bca8e..2131b4e88 100644 --- a/src/libstore/unix/build/derivation-builder.cc +++ b/src/libstore/unix/build/derivation-builder.cc @@ -1127,7 +1127,7 @@ void DerivationBuilderImpl::startBuilder() if (needsHashRewrite() && pathExists(homeDir)) throw Error("home directory '%1%' exists; please remove it to assure purity of builds without sandboxing", homeDir); - if (useChroot && settings.preBuildHook != "" && dynamic_cast(&drv)) { + if (useChroot && settings.preBuildHook != "") { printMsg(lvlChatty, "executing pre-build hook '%1%'", settings.preBuildHook); auto args = useChroot ? Strings({store.printStorePath(drvPath), chrootRootDir}) : Strings({ store.printStorePath(drvPath) });