Fixed #898 (Tokenizer: remove unneeded const after *)

This commit is contained in:
Daniel Marjamäki 2009-11-05 21:30:05 +01:00
parent 442584151b
commit 58c54d2ed4
2 changed files with 14 additions and 0 deletions

View File

@ -1788,6 +1788,12 @@ void Tokenizer::simplifySizeof()
void Tokenizer::simplifyTokenList()
{
for (Token *tok = _tokens; tok; tok = tok->next())
{
if (Token::simpleMatch(tok, "* const"))
tok->deleteNext();
}
simplifyNamespaces();
simplifyGoto();

View File

@ -135,6 +135,8 @@ private:
TEST_CASE(simplify_numeric_condition);
TEST_CASE(pointeralias);
TEST_CASE(reduceConstness);
}
std::string tok(const char code[], bool simplify = true)
@ -2148,6 +2150,12 @@ private:
ASSERT_EQUALS(expected, tok(code));
}
}
void reduceConstness()
{
ASSERT_EQUALS("char * p ;", tok("char * const p;"));
}
};
REGISTER_TEST(TestSimplifyTokens)