From 50a63f8435f03e47aa85136e3145ed58dff65734 Mon Sep 17 00:00:00 2001 From: Jade Lovelace Date: Sat, 13 Jul 2024 16:24:47 +0200 Subject: [PATCH] expr: fix a compiler warning about different signs in comparison We know that variable is >=0, so we can just cast it to unsigned. Change-Id: I3792eeb3ca43e6a507cc44c1a70584d42b2acd7b --- src/libexpr/primops.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 471ddc4f3..c1c606d1d 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -3275,10 +3275,12 @@ static RegisterPrimOp primop_all({ static void prim_genList(EvalState & state, const PosIdx pos, Value * * args, Value & v) { - auto len = state.forceInt(*args[1], pos, "while evaluating the second argument passed to builtins.genList").value; + auto len_ = state.forceInt(*args[1], pos, "while evaluating the second argument passed to builtins.genList").value; - if (len < 0) - state.error("cannot create list of size %1%", len).atPos(pos).debugThrow(); + if (len_ < 0) + state.error("cannot create list of size %1%", len_).atPos(pos).debugThrow(); + + size_t len = len_; // More strict than striclty (!) necessary, but acceptable // as evaluating map without accessing any values makes little sense.