From 9c44f500a8305ba6603875e49bc682f721fafa1d Mon Sep 17 00:00:00 2001 From: albert-github Date: Tue, 15 Jan 2019 15:04:24 +0100 Subject: issue #6764 Incorrect parsing of C enum comments defined using a macro When in a `/*` comment skip till end of the comment so a `,` won't be seen as the argument separator. --- src/pre.l | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/pre.l b/src/pre.l index 5eb0c5c..b18984e 100644 --- a/src/pre.l +++ b/src/pre.l @@ -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; @@ -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); -- cgit v0.12