Skip to content

Commit aa89f87

Browse files
committed
issue #7727: warning: documented symbol `static bool (long-winded C++ type)' was not declared or defined.
1 parent e2105a0 commit aa89f87

File tree

1 file changed

+32
-64
lines changed

1 file changed

+32
-64
lines changed

src/util.cpp

Lines changed: 32 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -5123,63 +5123,19 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te
51235123
return result;
51245124
}
51255125

5126-
#if 0 // original version
5126+
51275127
/*! Strips the scope from a name. Examples: A::B will return A
51285128
* and A<T>::B<N::C<D> > will return A<T>.
51295129
*/
51305130
QCString stripScope(const char *name)
5131-
{
5132-
QCString result = name;
5133-
int l=result.length();
5134-
int p=l-1;
5135-
bool done;
5136-
int count;
5137-
5138-
while (p>=0)
5139-
{
5140-
char c=result.at(p);
5141-
switch (c)
5142-
{
5143-
case ':':
5144-
//printf("stripScope(%s)=%s\n",name,result.right(l-p-1).data());
5145-
return result.right(l-p-1);
5146-
case '>':
5147-
count=1;
5148-
done=FALSE;
5149-
//printf("pos < = %d\n",p);
5150-
p--;
5151-
while (p>=0 && !done)
5152-
{
5153-
c=result.at(p--);
5154-
switch (c)
5155-
{
5156-
case '>': count++; break;
5157-
case '<': count--; if (count<=0) done=TRUE; break;
5158-
default:
5159-
//printf("c=%c count=%d\n",c,count);
5160-
break;
5161-
}
5162-
}
5163-
//printf("pos > = %d\n",p+1);
5164-
break;
5165-
default:
5166-
p--;
5167-
}
5168-
}
5169-
//printf("stripScope(%s)=%s\n",name,name);
5170-
return name;
5171-
}
5172-
#endif
5173-
5174-
// new version by Davide Cesari which also works for Fortran
5175-
QCString stripScope(const char *name)
51765131
{
51775132
QCString result = name;
51785133
int l=result.length();
51795134
int p;
51805135
bool done = FALSE;
51815136
bool skipBracket=FALSE; // if brackets do not match properly, ignore them altogether
51825137
int count=0;
5138+
int round=0;
51835139

51845140
do
51855141
{
@@ -5192,7 +5148,10 @@ QCString stripScope(const char *name)
51925148
case ':':
51935149
// only exit in the case of ::
51945150
//printf("stripScope(%s)=%s\n",name,result.right(l-p-1).data());
5195-
if (p>0 && result.at(p-1)==':') return result.right(l-p-1);
5151+
if (p>0 && result.at(p-1)==':' && (count==0 || skipBracket))
5152+
{
5153+
return result.right(l-p-1);
5154+
}
51965155
p--;
51975156
break;
51985157
case '>':
@@ -5216,20 +5175,29 @@ QCString stripScope(const char *name)
52165175
c=result.at(p--);
52175176
switch (c)
52185177
{
5219-
case '>':
5220-
count++;
5178+
case ')':
5179+
round++;
5180+
break;
5181+
case '(':
5182+
round--;
5183+
break;
5184+
case '>': // ignore > inside (...) to support e.g. (sizeof(T)>0) inside template parameters
5185+
if (round==0) count++;
52215186
break;
52225187
case '<':
5223-
if (p>0)
5188+
if (round==0)
52245189
{
5225-
if (result.at(p-1) == '<') // skip << operator
5190+
if (p>0)
52265191
{
5227-
p--;
5228-
break;
5192+
if (result.at(p-1) == '<') // skip << operator
5193+
{
5194+
p--;
5195+
break;
5196+
}
52295197
}
5198+
count--;
5199+
foundMatch = count==0;
52305200
}
5231-
count--;
5232-
foundMatch = count==0;
52335201
break;
52345202
default:
52355203
//printf("c=%c count=%d\n",c,count);
@@ -5910,19 +5878,19 @@ QCString stripTemplateSpecifiersFromScope(const QCString &fullName,
59105878
{
59115879
//printf("1:result+=%s\n",fullName.mid(p,i-p).data());
59125880
int e=i+1;
5913-
bool done=FALSE;
59145881
int count=1;
5915-
while (e<l && !done)
5882+
int round=0;
5883+
while (e<l && count>0)
59165884
{
59175885
char c=fullName.at(e++);
5918-
if (c=='<')
5919-
{
5920-
count++;
5921-
}
5922-
else if (c=='>')
5886+
switch (c)
59235887
{
5924-
count--;
5925-
done = count==0;
5888+
case '(': round++; break;
5889+
case ')': if (round>0) round--; break;
5890+
case '<': if (round==0) count++; break;
5891+
case '>': if (round==0) count--; break;
5892+
default:
5893+
break;
59265894
}
59275895
}
59285896
int si= fullName.find("::",e);

0 commit comments

Comments
 (0)