aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/eval.hh
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 05:51:23 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 05:51:23 +0100
commit5e182235cb7e7b601c5e010c298bf17415113ce0 (patch)
treed7dcfb54efbb5277184e0fcda9aa169b75e771ea /src/libexpr/eval.hh
parent30f3298e9dafa3bc4422c29dad972e320ad70e01 (diff)
Merge pull request #7348 from thufschmitt/dont-use-vlas
Remove the usage of VLAs in the code (cherry picked from commit ac4431e9d016e62fb5dc9ae36833bd0c6cdadeec) Change-Id: Ifbf5fbfc2e27122362a2aaea4b62c7cf3ca46b1a
Diffstat (limited to 'src/libexpr/eval.hh')
-rw-r--r--src/libexpr/eval.hh12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index 42dd73d11..4425efbca 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -18,6 +18,12 @@
namespace nix {
+/**
+ * We put a limit on primop arity because it lets us use a fixed size array on
+ * the stack. 8 is already an impractical number of arguments. Use an attrset
+ * argument for such overly complicated functions.
+ */
+constexpr size_t maxPrimOpArity = 8;
class Store;
class EvalState;
@@ -69,6 +75,12 @@ struct PrimOp
* Optional experimental for this to be gated on.
*/
std::optional<ExperimentalFeature> experimentalFeature;
+
+ /**
+ * Validity check to be performed by functions that introduce primops,
+ * such as RegisterPrimOp() and Value::mkPrimOp().
+ */
+ void check();
};
/**