diff options
| -rw-r--r-- | eval.cc | 5 | ||||
| -rw-r--r-- | eval.h | 2 |
2 files changed, 7 insertions, 0 deletions
@@ -444,6 +444,7 @@ void Evaluator::EvalInclude(const IncludeStmt* stmt) { } } + include_stack_.push_back(stmt->loc()); for (const string& fname : *files) { if (!stmt->should_exist && g_flags.ignore_optional_include_pattern && Pattern(g_flags.ignore_optional_include_pattern).Match(fname)) { @@ -451,6 +452,7 @@ void Evaluator::EvalInclude(const IncludeStmt* stmt) { } DoInclude(fname); } + include_stack_.pop_back(); } } @@ -555,6 +557,9 @@ string Evaluator::GetShellAndFlag() { } void Evaluator::Error(const string& msg) { + for (auto& inc : include_stack_) { + fprintf(stderr, "In file included from %s:%d:\n", LOCF(inc)); + } ERROR_LOC(loc_, "%s", msg.c_str()); } @@ -143,6 +143,8 @@ class Evaluator { bool is_bootstrap_; bool is_commandline_; + std::vector<Loc> include_stack_; + bool avoid_io_; // This value tracks the nest level of make expressions. For // example, $(YYY) in $(XXX $(YYY)) is evaluated with depth==2. |
