diff options
author | Jade Lovelace <lix@jade.fyi> | 2024-07-13 16:24:47 +0200 |
---|---|---|
committer | jade <lix@jade.fyi> | 2024-07-18 19:27:33 +0000 |
commit | 50a63f8435f03e47aa85136e3145ed58dff65734 (patch) | |
tree | 88dbb7630cbbf04ce97c8a9c5812f2e8fc3d8a7a /src/libexpr/primops.cc | |
parent | 5ee1e6ea9887a54f0af3a66528abc04b17611516 (diff) |
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
Diffstat (limited to 'src/libexpr/primops.cc')
-rw-r--r-- | src/libexpr/primops.cc | 8 |
1 files 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<EvalError>("cannot create list of size %1%", len).atPos(pos).debugThrow(); + if (len_ < 0) + state.error<EvalError>("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. |