From a10da8466f56a4cb91f01dde6925b03a836cead7 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 17 Oct 2007 12:36:37 +0000 Subject: [PATCH] * Option to turn off position information to test the impact on maximal sharing. --- src/libexpr/eval.cc | 4 +++- src/libexpr/parser.y | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index e92ed50fd..1410e5144 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -21,7 +21,8 @@ int cacheTerms; bool shortCircuit; bool closedTerms; // don't substitute under terms known to be closed -bool substCache; // memoization of the term substitution function +bool substCache; // memoization of the term substitution function +bool posInfo; // attach position info to functions, assertions, attributes #define maxActiveCalls 4096 @@ -43,6 +44,7 @@ EvalState::EvalState() strictMode = getEnv("NIX_STRICT", "0") == "1"; closedTerms = getEnv("NIX_CLOSED_TERMS", "1") == "1"; substCache = getEnv("NIX_SUBST_CACHE", "1") == "1"; + posInfo = getEnv("NIX_POS_INFO", "1") == "1"; ATprotectMemory(activeCalls, maxActiveCalls); } diff --git a/src/libexpr/parser.y b/src/libexpr/parser.y index e943bdc97..93dd653c0 100644 --- a/src/libexpr/parser.y +++ b/src/libexpr/parser.y @@ -70,11 +70,13 @@ static Expr fixAttrs(int recursive, ATermList as) void backToString(yyscan_t scanner); + +extern bool posInfo; static Pos makeCurPos(YYLTYPE * loc, ParseData * data) { - return makePos(toATerm(data->path), - loc->first_line, loc->first_column); + return posInfo ? makePos(toATerm(data->path), + loc->first_line, loc->first_column) : makeNoPos(); } #define CUR_POS makeCurPos(yylocp, data)