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:
parent
d53eb9e303
commit
977e31786d
|
@ -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;
|
||||
|
||||
|
|
|
@ -597,12 +597,20 @@ 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));
|
||||
}
|
||||
}
|
||||
|
||||
void macro_simple2()
|
||||
{
|
||||
const char filedata[] = "#define min(x,y) x<y?x:y\n"
|
||||
|
|
Loading…
Reference in New Issue