From 4dba9fbdda10889d2285b85b7e9ff6282b34fccf Mon Sep 17 00:00:00 2001 From: albert-github Date: Wed, 13 Jan 2021 18:26:35 +0100 Subject: bug_305773 Volatile declaration is missing for variables in XML output Handle "const" and "volatile" in the same way, they are bit cv-qualifiers --- src/doxygen.cpp | 9 ++++++--- src/scanner.l | 12 ++++++++++++ src/sqlite3gen.cpp | 1 - src/symbolresolver.cpp | 1 + src/util.cpp | 24 ++++++++++++++++++++++++ src/xmlgen.cpp | 1 - 6 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/doxygen.cpp b/src/doxygen.cpp index 3fdde9b..f3e5ef0 100644 --- a/src/doxygen.cpp +++ b/src/doxygen.cpp @@ -2613,9 +2613,12 @@ static bool isVarWithConstructor(const Entry *root) { resType=resType.left(len); //printf("resType=%s\n",resType.data()); - if (resType=="int" || resType=="long" || resType=="float" || - resType=="double" || resType=="char" || resType=="signed" || - resType=="const" || resType=="unsigned" || resType=="void") + if (resType=="int" || resType=="long" || + resType=="float" || resType=="double" || + resType=="char" || + resType=="signed" || resType=="unsigned" || + resType=="const" || resType=="volatile" || + resType=="void") { result=FALSE; // type keyword -> function prototype goto done; diff --git a/src/scanner.l b/src/scanner.l index 66437bc..6441165 100644 --- a/src/scanner.l +++ b/src/scanner.l @@ -2196,6 +2196,18 @@ OPERATOR "operator"{B}*({ARITHOP}|{ASSIGNOP}|{LOGICOP}|{BITOP}) } yyextra->current->name=yyextra->current->name.mid(6); } + else if (yyextra->current->name.left(9)=="volatile ") + { + if (yyextra->current->type.isEmpty()) + { + yyextra->current->type="volatile"; + } + else + { + yyextra->current->type+="volatile "; + } + yyextra->current->name=yyextra->current->name.mid(9); + } } QCString tmp=yytext; if (nameIsOperator(tmp)) diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index 67adebf..f0d2a12 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -1143,7 +1143,6 @@ static void stripQualifiers(QCString &typeStr) { if (typeStr.stripPrefix("static ")); else if (typeStr.stripPrefix("virtual ")); - else if (typeStr.stripPrefix("volatile ")); else if (typeStr=="virtual") typeStr=""; else done=TRUE; } diff --git a/src/symbolresolver.cpp b/src/symbolresolver.cpp index 9f80c15..80ec700 100644 --- a/src/symbolresolver.cpp +++ b/src/symbolresolver.cpp @@ -533,6 +533,7 @@ const ClassDef *SymbolResolver::Private::newResolveTypedef( } type=type.left(ip+1); type.stripPrefix("const "); // strip leading "const" + type.stripPrefix("volatile "); // strip leading "volatile" type.stripPrefix("struct "); // strip leading "struct" type.stripPrefix("union "); // strip leading "union" int sp=0; diff --git a/src/util.cpp b/src/util.cpp index 3feb8db..7bc9565 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -510,6 +510,7 @@ int computeQualifiedIndex(const QCString &name) //------------------------------------------------------------------------- static const char constScope[] = { 'c', 'o', 'n', 's', 't', ':' }; +static const char volatileScope[] = { 'v', 'o', 'l', 'a', 't', 'i', 'l', 'e', ':' }; static const char virtualScope[] = { 'v', 'i', 'r', 't', 'u', 'a', 'l', ':' }; static const char operatorScope[] = { 'o', 'p', 'e', 'r', 'a', 't', 'o', 'r', '?', '?', '?' }; @@ -580,6 +581,7 @@ QCString removeRedundantWhiteSpace(const QCString &s) uint i=0; uint l=s.length(); uint csp=0; + uint vosp=0; uint vsp=0; uint osp=0; char c; @@ -605,6 +607,16 @@ QCString removeRedundantWhiteSpace(const QCString &s) else // reset counter csp=0; + if (vosp<6 && c==volatileScope[vosp] && // character matches substring "volatile" + (vosp>0 || // inside search string + i==0 || // if it is the first character + !isId(pc) // the previous may not be a digit + ) + ) + vosp++; + else // reset counter + vosp=0; + // search for "virtual" if (vsp<8 && c==virtualScope[vsp] && // character matches substring "virtual" (vsp>0 || // inside search string @@ -742,6 +754,11 @@ QCString removeRedundantWhiteSpace(const QCString &s) *dst++=' '; csp=0; } + else if (vosp==9) // replace volatile::A by volatile ::A + { + *dst++=' '; + vosp=0; + } else if (vsp==8) // replace virtual::A by virtual ::A { *dst++=' '; @@ -779,6 +796,13 @@ QCString removeRedundantWhiteSpace(const QCString &s) *dst++=' '; csp=0; } + else if (c=='e' && vosp==8 && i