Skip to content

Commit bd373c9

Browse files
committed
Improved/simplified initialization of GuardedSection stack
1 parent 09ef0d5 commit bd373c9

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

src/cite.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void CitationManager::generatePage()
461461
CommentScanner commentScanner;
462462
int lineNr = 0;
463463
int pos = 0;
464-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
464+
GuardedSectionStack guards;
465465
Protection prot = Protection::Public;
466466
commentScanner.parseCommentBlock(
467467
nullptr,

src/commentscan.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
#define COMMENTSCAN_H
1818

1919
#include <memory>
20+
#include <stack>
21+
2022
#include "types.h"
2123
#include "construct.h"
2224

@@ -43,6 +45,8 @@ class GuardedSection
4345
bool m_hasElse = false;
4446
};
4547

48+
using GuardedSectionStack = std::stack<GuardedSection>;
49+
4650
/** @file
4751
* @brief Interface for the comment block scanner */
4852

@@ -102,7 +106,7 @@ class CommentScanner
102106
int &position,
103107
bool &newEntryNeeded,
104108
bool markdownEnabled,
105-
std::stack<GuardedSection> *guards
109+
GuardedSectionStack *guards
106110
);
107111
void initGroupInfo(Entry *entry);
108112
void enterFile(const QCString &fileName,int lineNr);

src/commentscan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ struct commentscanYY_state
460460
XRefKind newXRefKind = XRef_Item; //
461461
GuardType guardType = Guard_If; // kind of guards for conditional section
462462
QCString functionProto; // function prototype
463-
std::stack<GuardedSection> *guards; // tracks nested conditional sections (if,ifnot,..)
463+
GuardedSectionStack *guards = nullptr; // tracks nested conditional sections (if,ifnot,..)
464464
Entry *current = nullptr; // working entry
465465

466466
bool needNewEntry = FALSE;
@@ -4597,7 +4597,7 @@ bool CommentScanner::parseCommentBlock(/* in */ OutlineParserInterface *pars
45974597
/* in,out */ int &position,
45984598
/* out */ bool &newEntryNeeded,
45994599
/* in */ bool markdownSupport,
4600-
/* inout */ std::stack<GuardedSection> *guards
4600+
/* inout */ GuardedSectionStack *guards
46014601
)
46024602
{
46034603
AUTO_TRACE("comment='{}' fileName={} lineNr={} isBrief={} isAutoBriefOn={} inInbody={}"

src/fortranscanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3052,7 +3052,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
30523052
int position=0;
30533053
bool needsEntry = FALSE;
30543054
Markdown markdown(yyextra->fileName,lineNr);
3055-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
3055+
GuardedSectionStack guards;
30563056
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
30573057
while (yyextra->commentScanner.parseCommentBlock(
30583058
yyextra->thisParser,

src/markdown.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3575,7 +3575,7 @@ void MarkdownOutlineParser::parseInput(const QCString &fileName,
35753575
Protection prot = Protection::Public;
35763576
bool needsEntry = false;
35773577
int position=0;
3578-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
3578+
GuardedSectionStack guards;
35793579
QCString processedDocs = markdown.process(docs,lineNr,true);
35803580
while (p->commentScanner.parseCommentBlock(
35813581
this,

src/pyscanner.l

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
19171917
bool needsEntry = false;
19181918
int lineNr = brief ? yyextra->current->briefLine : yyextra->current->docLine;
19191919
Markdown markdown(yyextra->fileName,lineNr);
1920-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
1920+
GuardedSectionStack guards;
19211921
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
19221922
while (yyextra->commentScanner.parseCommentBlock(
19231923
yyextra->thisParser,

src/scanner.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7875,7 +7875,7 @@ static void handleCommentBlock(yyscan_t yyscanner,const QCString &doc,bool brief
78757875
78767876
int position=0;
78777877
bool needsEntry=FALSE;
7878-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
7878+
GuardedSectionStack guards;
78797879
Markdown markdown(yyextra->fileName,lineNr);
78807880
QCString strippedDoc = stripIndentation(doc);
78817881
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;
@@ -7941,7 +7941,7 @@ static void handleParametersCommentBlocks(yyscan_t yyscanner,ArgumentList &al)
79417941
79427942
//printf("handleParametersCommentBlock [%s]\n",qPrint(doc));
79437943
int lineNr = orgDocLine;
7944-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
7944+
GuardedSectionStack guards;
79457945
Markdown markdown(yyextra->fileName,lineNr);
79467946
QCString strippedDoc = stripIndentation(a.docs);
79477947
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(strippedDoc,lineNr) : strippedDoc;

src/vhdljjparser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ void VHDLOutlineParser::handleCommentBlock(const QCString &doc1, bool brief)
433433

434434
Markdown markdown(p->yyFileName,p->iDocLine);
435435
int lineNr = p->iDocLine;
436-
std::stack<GuardedSection> guards = std::stack<GuardedSection>();
436+
GuardedSectionStack guards;
437437
QCString processedDoc = Config_getBool(MARKDOWN_SUPPORT) ? markdown.process(doc,lineNr) : doc;
438438

439439
while (p->commentScanner.parseCommentBlock(

0 commit comments

Comments
 (0)