Skip to content

Commit

Permalink
issue #6764 Incorrect parsing of C enum comments defined using a macro
Browse files Browse the repository at this point in the history
When in a `/*` comment skip till end of the comment so a `,` won't be seen as the argument separator.
  • Loading branch information
albert-github committed Jan 15, 2019
1 parent 6a1b370 commit 9c44f50
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/pre.l
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,21 @@ static bool replaceFunctionMacro(const QCString &expr,QCString *rest,int pos,int
arg+=c;
}
}
else if (c=='/') // possible start of a comment
{
char prevChar = '\0';
arg+=c;
if ((cc=getCurrentChar(expr,rest,j)) == '*') // we have a comment
{
while ((cc=getNextChar(expr,rest,j))!=EOF && cc!=0)
{
c=(char)cc;
arg+=c;
if (c == '/' && prevChar == '*') break; // we have an end of comment
prevChar = c;
}
}
}
else // append other characters
{
arg+=c;
Expand Down Expand Up @@ -1110,7 +1125,6 @@ static void expandExpression(QCString &expr,QCString *rest,int pos)

if (replaced) // expand the macro and rescan the expression
{

//printf("replacing `%s'->`%s'\n",expr.mid(p,len).data(),expMacro.data());
QCString resultExpr=expMacro;
QCString restExpr=expr.right(expr.length()-len-p);
Expand Down

0 comments on commit 9c44f50

Please sign in to comment.