Skip to content

Commit 78c2ceb

Browse files
committed
issue doxygen#12213 Function parameters of type array of function pointers parsed incorrectly when there is 'static' or qualifiers in the square brackets
1 parent 1828b63 commit 78c2ceb

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/defargs.l

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,12 @@ CPPC "/\/"
159159
<ReadFuncArgType>{B}* {
160160
yyextra->curArgTypeName+=" ";
161161
}
162-
<ReadFuncArgType>"["[^\]]*"]" {
163-
if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
162+
<ReadFuncArgType,ReadFuncArgPtr>"["[^\]]*"]" {
163+
if (YY_START==ReadFuncArgPtr)
164+
{
165+
yyextra->curArgTypeName+=yytext;
166+
}
167+
else if (yyextra->curArgTypeName.stripWhiteSpace().isEmpty())
164168
{
165169
yyextra->curArgAttrib=yytext; // for M$-IDL
166170
}

src/memberdef.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,8 +1141,19 @@ static bool writeDefArgumentList(OutputList &ol,const Definition *scope,const Me
11411141
{
11421142
atype=addTemplateNames(atype,scope->name(),cName);
11431143
}
1144-
funcPtrPos = atype.find("*)(");
1145-
if (funcPtrPos!=-1) funcPtrPos++;
1144+
// 1. split ...*)(... -> '*' + name + ')(...'
1145+
// 2. split ...*[some thing])(... -> '*' + name + '[some thing])(...'
1146+
int starPos = atype.find('*'); // find pointer
1147+
if (starPos==-1) starPos = atype.find('&'); // can also be reference
1148+
funcPtrPos = atype.find(")(");
1149+
if (starPos!=-1 && funcPtrPos>starPos)
1150+
{
1151+
funcPtrPos=starPos+1;
1152+
}
1153+
else
1154+
{
1155+
funcPtrPos=-1;
1156+
}
11461157
linkifyText(TextGeneratorOLImpl(ol),
11471158
funcPtrPos==-1 ? atype : atype.left(funcPtrPos),
11481159
options);

0 commit comments

Comments
 (0)