From 7dfad3dba73198b84958c1b91cecbbb3cc37d3ca Mon Sep 17 00:00:00 2001 From: Sergei Zimmerman Date: Fri, 28 Nov 2025 00:35:56 +0300 Subject: [PATCH] libexpr: Fix tests on 32 bit systems This test is now pointless and the comment is outdated. Also the test fails on 32 bit systems with: ../nix_api_value_internal.cc:22: Failure Expected equality of these values: sizeof(nix::Value) Which is: 12 sizeof(nix_value) Which is: 8 It just happeneded to work because Value is 16 bytes and nix_value was also 16 bytes. Also get rid of a pointless inline in new_nix_value, since it's already static and inline there does nothing. --- src/libexpr-c/nix_api_value.cc | 2 +- src/libexpr-tests/nix_api_value_internal.cc | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/libexpr-c/nix_api_value.cc b/src/libexpr-c/nix_api_value.cc index be8ff4926..7fd8233ad 100644 --- a/src/libexpr-c/nix_api_value.cc +++ b/src/libexpr-c/nix_api_value.cc @@ -58,7 +58,7 @@ static nix::Value & check_value_out(nix_value * value) return v; } -static inline nix_value * new_nix_value(nix::Value * v, nix::EvalMemory & mem) +static nix_value * new_nix_value(nix::Value * v, nix::EvalMemory & mem) { nix_value * ret = new (mem.allocBytes(sizeof(nix_value))) nix_value{ .value = v, diff --git a/src/libexpr-tests/nix_api_value_internal.cc b/src/libexpr-tests/nix_api_value_internal.cc index 34db6ac81..085b0798f 100644 --- a/src/libexpr-tests/nix_api_value_internal.cc +++ b/src/libexpr-tests/nix_api_value_internal.cc @@ -14,12 +14,4 @@ namespace nixC { -TEST_F(nix_api_expr_test, as_nix_value_ptr) -{ - // nix_alloc_value casts nix::Value to nix_value - // It should be obvious from the decl that that works, but if it doesn't, - // the whole implementation would be utterly broken. - ASSERT_EQ(sizeof(nix::Value), sizeof(nix_value)); -} - } // namespace nixC