diff options
| author | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-06-09 16:14:51 +0900 |
|---|---|---|
| committer | Shinichiro Hamaji <shinichiro.hamaji@gmail.com> | 2016-06-09 16:14:51 +0900 |
| commit | 52fe6fcb7e0143e48b8f82f92283dea89e5c3741 (patch) | |
| tree | 41ac43c8297118a1a3c3b15b2b114f242dd69188 | |
| parent | 3e98b6b9f822c6a142eea55a9d387be88b6f02d9 (diff) | |
[C++] Do not evaluate recursive variable in ifdef
This fixes #79
| -rw-r--r-- | eval.cc | 3 | ||||
| -rw-r--r-- | testcase/ifdef_rec_var.mk | 8 |
2 files changed, 9 insertions, 2 deletions
@@ -201,8 +201,7 @@ void Evaluator::EvalIf(const IfStmt* stmt) { if (lhs.str().find_first_of(" \t") != string::npos) Error("*** invalid syntax in conditional."); Var* v = LookupVarInCurrentScope(lhs); - const string&& s = v->Eval(this); - is_true = (s.empty() == (stmt->op == CondOp::IFNDEF)); + is_true = (v->String().empty() == (stmt->op == CondOp::IFNDEF)); break; } case CondOp::IFEQ: diff --git a/testcase/ifdef_rec_var.mk b/testcase/ifdef_rec_var.mk new file mode 100644 index 0000000..0874d2e --- /dev/null +++ b/testcase/ifdef_rec_var.mk @@ -0,0 +1,8 @@ +empty=$(info FAIL) +rec=$(empty) + +ifdef rec +$(info PASS) +else +$(info FAIL) +endif |
