Fix ticket #332 (White space between macro name and '(' causes macro simplification to fail)

http://apps.sourceforge.net/trac/cppcheck/ticket/332
This commit is contained in:
Reijo Tomperi 2009-05-24 23:57:12 +03:00
parent d53eb9e303
commit 977e31786d
2 changed files with 14 additions and 3 deletions

View File

@ -1111,6 +1111,9 @@ std::string Preprocessor::expandMacros(std::string code, const std::string &file
if (macro.params().size())
{
if (code[pos2] == ' ')
pos2++;
if (code[pos2] != '(')
continue;

View File

@ -598,9 +598,17 @@ private:
void macro_simple1()
{
const char filedata[] = "#define AAA(aa) f(aa)\n"
"AAA(5);\n";
ASSERT_EQUALS("\nf(5);\n", OurPreprocessor::expandMacros(filedata));
{
const char filedata[] = "#define AAA(aa) f(aa)\n"
"AAA(5);\n";
ASSERT_EQUALS("\nf(5);\n", OurPreprocessor::expandMacros(filedata));
}
{
const char filedata[] = "#define AAA(aa) f(aa)\n"
"AAA (5);\n";
ASSERT_EQUALS("\nf(5);\n", OurPreprocessor::expandMacros(filedata));
}
}
void macro_simple2()