Fixed #1014 (Preprocessor: Invalid preprocessing of '#define some_delete(x) delete x;')

This commit is contained in:
Daniel Marjamäki 2009-11-26 17:32:18 +01:00
parent 12a87fa3a4
commit 7616246597
2 changed files with 9 additions and 1 deletions

View File

@ -1703,7 +1703,7 @@ public:
}
optcomma = false;
macrocode += str;
if (Token::Match(tok, "%type% %var%"))
if (Token::Match(tok, "%var% %var%"))
macrocode += " ";
}
}

View File

@ -123,6 +123,7 @@ private:
TEST_CASE(macro_simple8);
TEST_CASE(macro_simple9);
TEST_CASE(macro_simple10);
TEST_CASE(macro_simple11);
TEST_CASE(macroInMacro);
TEST_CASE(macro_mismatch);
TEST_CASE(macro_linenumbers);
@ -1012,6 +1013,13 @@ private:
ASSERT_EQUALS("\nunsigned long x;", OurPreprocessor::expandMacros(filedata));
}
void macro_simple11()
{
const char filedata[] = "#define ABC(x) delete x\n"
"ABC(a);";
ASSERT_EQUALS("\ndelete a;", OurPreprocessor::expandMacros(filedata));
}
void macroInMacro()
{
{