Reverted fix. It might be possible to make a better fix

This commit is contained in:
Daniel Marjamäki 2013-03-25 19:55:35 +01:00
parent 2b02013fa7
commit 2d70af2c82
2 changed files with 0 additions and 32 deletions

View File

@ -1579,32 +1579,6 @@ bool Tokenizer::tokenize(std::istream &code,
syntaxError(tok);
return false;
}
} else if (Token::simpleMatch(tok, "if (")) {
bool macro = false;
unsigned int parlevel = 0;
for (const Token *tok2 = tok->next(); tok2; tok2 = tok2->next()) {
if (tok2->str() == "(")
++parlevel;
else if (parlevel > 0 && tok2->str() == ")") {
--parlevel;
if (parlevel == 0) {
if (Token::Match(tok2, ") %var% [({]") && tok2->next()->isUpperCaseName())
macro = true;
else if (!macro)
break;
}
}
if (tok2->str() == ";")
break;
if (tok2->str() == "{") {
if (macro) {
syntaxError(tok2);
return false;
} else {
break;
}
}
}
}
}

View File

@ -770,12 +770,6 @@ private:
const std::string code("void f() { if MACRO(); }");
tokenizeAndStringify(code.c_str(), false);
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
// #4668
errout.str("");
const char code2[] = "void f() { if (x) MACRO() {} }";
tokenizeAndStringify(code2, false);
ASSERT_EQUALS("[test.cpp:1]: (error) syntax error\n", errout.str());
}
void wrong_syntax_class_x_y() {