diff options
author | jade <lix@jade.fyi> | 2024-05-30 14:57:37 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@lix-systems> | 2024-05-30 14:57:37 +0000 |
commit | 18aa3e1d570b4ecbb9962376e5fba5757dad8da9 (patch) | |
tree | ad9edb3d85c7f3e9b6a33f65efeebbdbc9bd243b /src/libexpr | |
parent | 53d40888ffe8238ab5baf6a9d1a7481c29e9c65d (diff) | |
parent | 7575db522e9008685c4009423398f6900a16bcce (diff) |
Merge "Remove 100s of CPU time (10%) from build times (1465s -> 1302s)" into main
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/eval.cc | 2 | ||||
-rw-r--r-- | src/libexpr/lexer.l | 10 | ||||
-rw-r--r-- | src/libexpr/nixexpr.cc | 1 | ||||
-rw-r--r-- | src/libexpr/primops.cc | 1 | ||||
-rw-r--r-- | src/libexpr/print.cc | 1 |
5 files changed, 9 insertions, 6 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index c9a624eeb..c72b69af2 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -22,6 +22,7 @@ #include <algorithm> #include <chrono> #include <iostream> +#include <sstream> #include <cstring> #include <optional> #include <unistd.h> @@ -29,7 +30,6 @@ #include <sys/resource.h> #include <fstream> #include <functional> -#include <iostream> #include <sys/resource.h> #include <nlohmann/json.hpp> diff --git a/src/libexpr/lexer.l b/src/libexpr/lexer.l index 1780f5cb9..1c1cdd673 100644 --- a/src/libexpr/lexer.l +++ b/src/libexpr/lexer.l @@ -26,10 +26,9 @@ #pragma clang diagnostic ignored "-Wimplicit-fallthrough" #endif -#include <boost/lexical_cast.hpp> - #include "nixexpr.hh" #include "parser-tab.hh" +#include "strings.hh" using namespace nix; @@ -132,9 +131,10 @@ or { return OR_KW; } {ID} { yylval->id = {yytext, (size_t) yyleng}; return ID; } {INT} { errno = 0; - try { - yylval->n = boost::lexical_cast<int64_t>(yytext); - } catch (const boost::bad_lexical_cast &) { + std::optional<int64_t> numMay = string2Int<int64_t>(yytext); + if (numMay.has_value()) { + yylval->n = *numMay; + } else { throw ParseError(ErrorInfo{ .msg = HintFmt("invalid integer '%1%'", yytext), .pos = state->positions[CUR_POS], diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 6a1aa8f35..664872882 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -6,6 +6,7 @@ #include "escape-string.hh" #include <cstdlib> +#include <sstream> namespace nix { diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index f8ce90ac1..3cc2659fb 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -25,6 +25,7 @@ #include <algorithm> #include <cstring> +#include <sstream> #include <regex> #include <dlfcn.h> diff --git a/src/libexpr/print.cc b/src/libexpr/print.cc index c56b0e72e..e387a09fb 100644 --- a/src/libexpr/print.cc +++ b/src/libexpr/print.cc @@ -1,6 +1,7 @@ #include <limits> #include <span> #include <unordered_set> +#include <sstream> #include "escape-string.hh" #include "print.hh" |