Preprocessor: Fixed TODO_ASSERT_EQUALS
This commit is contained in:
parent
4d185f0935
commit
c6f913ac3e
|
@ -920,7 +920,21 @@ void Preprocessor::simplifyCondition(const std::map<std::string, std::string> &v
|
|||
}
|
||||
|
||||
// simplify calculations..
|
||||
tokenizer.simplifyCalculations();
|
||||
bool modified = true;
|
||||
while (modified)
|
||||
{
|
||||
modified = false;
|
||||
tokenizer.simplifyCalculations();
|
||||
for (Token *tok = const_cast<Token *>(tokenizer.tokens()); tok; tok = tok->next())
|
||||
{
|
||||
if (Token::Match(tok, "! %num%"))
|
||||
{
|
||||
tok->deleteThis();
|
||||
tok->str(tok->str() == "0" ? "1" : "0");
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Token::simpleMatch(tokenizer.tokens(), "( 1 )") ||
|
||||
Token::simpleMatch(tokenizer.tokens(), "( 1 ||"))
|
||||
|
|
|
@ -611,10 +611,10 @@ private:
|
|||
cfg["ABC"] = "";
|
||||
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def(cfg, "defined(A)"));
|
||||
TODO_ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "!defined(A)"));
|
||||
ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "!defined(A)"));
|
||||
|
||||
ASSERT_EQUALS(false, Preprocessor::match_cfg_def(cfg, "!defined(ABC)&&!defined(DEF)"));
|
||||
TODO_ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "!defined(A)&&!defined(B)"));
|
||||
ASSERT_EQUALS(true, Preprocessor::match_cfg_def(cfg, "!defined(A)&&!defined(B)"));
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue