From 6238db3a78b38fc67fe46c46184a6e7208b93507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sat, 26 Jan 2013 19:11:58 +0100 Subject: [PATCH] Preprocessor: Fix hang --- lib/preprocessor.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index c2cf00017..446836149 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -993,7 +993,7 @@ std::string Preprocessor::getdef(std::string line, bool def) } /** Simplify variable in variable map. */ -static void simplifyVarMapExpandValue(Token *tok, const std::map &variables, std::set seenVariables) +static void simplifyVarMapExpandValue(Token *tok, const std::map &variables, std::set &seenVariables) { // TODO: handle function-macros too. @@ -1033,12 +1033,13 @@ static void simplifyVarMapExpandValue(Token *tok, const std::map &variables) { for (std::map::iterator i = variables.begin(); i != variables.end(); ++i) { + std::set seenVariables; + TokenList tokenList(NULL); std::istringstream istr(i->second); if (tokenList.createTokens(istr)) { for (Token *tok = tokenList.front(); tok; tok = tok->next()) { if (tok->isName()) { - std::set seenVariables; simplifyVarMapExpandValue(tok, variables, seenVariables); } } @@ -1937,6 +1938,12 @@ std::string Preprocessor::handleIncludes(const std::string &code, const std::str std::set undefs = _settings ? _settings->userUndefs : std::set(); + if (_errorLogger) + _errorLogger->reportProgress(filePath, "Preprocessor (handleIncludes)", 0); + + if (_settings && _settings->terminated()) + return ""; + std::ostringstream ostr; std::istringstream istr(code); std::string line;