Loading parser.cpp +3 −0 Changes for parser.cpp: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1035,6 +1035,9 @@ std::string Parser::expand_recursive_var( // Break self-referential expansion cycles. GNU make aborts with // "Recursive variable references itself"; we instead treat the recursive // reference as empty so a single legitimate self-append still terminates. // thread_local so concurrent recipe/export expansions under -j each get // their own recursion guard rather than corrupting a shared set. static thread_local std::set<std::string> expanding_; if (!expanding_.insert(name).second) return ""; std::string out = do_expand(value, mf, auto_vars); expanding_.erase(name); Loading parser.h +2 −1 Changes for parser.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ private: // break self-referential cycles (e.g. "X = $(X) more") that would otherwise // recurse until the process exhausts memory. Matches GNU make, which refuses // to expand a variable that references itself. mutable std::set<std::string> expanding_; // (The recursion guard itself lives as a thread_local inside // expand_recursive_var so concurrent expansions under -j stay independent.) // Expand a recursively-flavored variable's value while guarding against // cycles; returns "" if 'name' is already on the expansion stack. std::string expand_recursive_var(const std::string& name, const std::string& value, Loading Loading
parser.cpp +3 −0 Changes for parser.cpp: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -1035,6 +1035,9 @@ std::string Parser::expand_recursive_var( // Break self-referential expansion cycles. GNU make aborts with // "Recursive variable references itself"; we instead treat the recursive // reference as empty so a single legitimate self-append still terminates. // thread_local so concurrent recipe/export expansions under -j each get // their own recursion guard rather than corrupting a shared set. static thread_local std::set<std::string> expanding_; if (!expanding_.insert(name).second) return ""; std::string out = do_expand(value, mf, auto_vars); expanding_.erase(name); Loading
parser.h +2 −1 Changes for parser.h: 2 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -112,7 +112,8 @@ private: // break self-referential cycles (e.g. "X = $(X) more") that would otherwise // recurse until the process exhausts memory. Matches GNU make, which refuses // to expand a variable that references itself. mutable std::set<std::string> expanding_; // (The recursion guard itself lives as a thread_local inside // expand_recursive_var so concurrent expansions under -j stay independent.) // Expand a recursively-flavored variable's value while guarding against // cycles; returns "" if 'name' is already on the expansion stack. std::string expand_recursive_var(const std::string& name, const std::string& value, Loading