diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2020-03-18 16:21:10 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-18 16:21:10 -0700 |
| commit | 2ed78597a2530631a7edd000d1623f8ccae07596 (patch) | |
| tree | 4132282342b41159e2cffacfc5c9db85c3eddfba | |
| parent | 48309792d94c7b8d84e86193ee802232d108c9dd (diff) | |
| parent | a705d28cf59ad89b2081c9cfdb9719dc8b0a49e7 (diff) | |
| download | platform_build_kati-2ed78597a2530631a7edd000d1623f8ccae07596.tar.gz platform_build_kati-2ed78597a2530631a7edd000d1623f8ccae07596.tar.bz2 platform_build_kati-2ed78597a2530631a7edd000d1623f8ccae07596.zip | |
Merge pull request #185 from pcc/include-stack
Display include stack when encountering an error.
| -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. |
