Skip to content

Commit 2df311b

Browse files
committed
Wrong links for stateToString in internal doxygen documentation
When looking at the code of e.g. scanner.l in the doxygen internal documentation and looking at the prototype of the function `stateToString` this function is linked to the same function in the fortranscanner (although this should no happen as the function is `static`). Due to the fact that the `stateToString` functionality is only enabled in the fortranscanner, but in the other lex scanners the prototype and the implementation is hidden inside a `#if` block but the (lex)code scanners still find it as it does not take the `#if` into account. - enable the functionality of `stateToString` everywhere even when not used - make the prototypes `[[maybe_unused]]` to satisfy the compilers (warnings) - adjust `pre.l` so that the counting of the open / close brackets is correct when they are used in the rules (code taken from lexscanner.l) - some minor fixes to keep the preprocessor happy (commands in regular comments, escape double quotes in `[...]` part of the rules
1 parent ed26ff0 commit 2df311b

18 files changed

+180
-133
lines changed

src/code.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ typedef yyguts_t *yyscan_t;
7878
#define SCOPEBLOCK 2
7979
#define INNERBLOCK 3
8080

81-
#define USE_STATE2STRING 0
82-
8381
// context for an Objective-C method call
8482
struct ObjCCallCtx
8583
{
@@ -197,9 +195,7 @@ struct codeYY_state
197195
static bool isCastKeyword(const char *s);
198196

199197
//-------------------------------------------------------------------
200-
#if USE_STATE2STRING
201-
static const char *stateToString(int state);
202-
#endif
198+
[[maybe_unused]] static const char *stateToString(int state);
203199

204200
static void saveObjCContext(yyscan_t yyscanner);
205201
static void restoreObjCContext(yyscan_t yyscanner);
@@ -4202,6 +4198,4 @@ void CCodeParser::parseCode(OutputCodeList &od,const QCString &className,const Q
42024198
yyextra->tooltipManager.writeTooltips(od);
42034199
}
42044200

4205-
#if USE_STATE2STRING
42064201
#include "code.l.h"
4207-
#endif

src/commentcnv.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ typedef yyguts_t *yyscan_t;
4949
#define ADDCHAR(c) yyextra->outBuf.addChar(c)
5050
#define ADDARRAY(a,s) yyextra->outBuf.addArray(a,s)
5151

52-
#define USE_STATE2STRING 0
53-
5452
struct commentcnvYY_CondCtx
5553
{
5654
commentcnvYY_CondCtx(int line,const QCString &id,bool b)
@@ -105,9 +103,7 @@ struct commentcnvYY_state
105103
bool isFixedForm = FALSE; // For Fortran
106104
};
107105

108-
#if USE_STATE2STRING
109-
static const char *stateToString(int state);
110-
#endif
106+
[[maybe_unused]] static const char *stateToString(int state);
111107
static inline int computeIndent(const char *s);
112108

113109
static void replaceCommentMarker(yyscan_t yyscanner,const char *s,int len);
@@ -1290,6 +1286,4 @@ void convertCppComments(const BufStr &inBuf,BufStr &outBuf,const QCString &fileN
12901286

12911287
//----------------------------------------------------------------------------
12921288

1293-
#if USE_STATE2STRING
12941289
#include "commentcnv.l.h"
1295-
#endif

src/commentscan.l

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ typedef yyguts_t *yyscan_t;
6464
#include "trace.h"
6565
#include "debug.h"
6666

67-
#define USE_STATE2STRING 0
68-
6967
// forward declarations
7068
static bool handleBrief(yyscan_t yyscanner,const QCString &, const StringVector &);
7169
static bool handleFn(yyscan_t yyscanner,const QCString &, const StringVector &);
@@ -166,9 +164,7 @@ static bool handleFileInfo(yyscan_t yyscanner,const QCString &, const StringVect
166164
static bool handleLineInfo(yyscan_t yyscanner,const QCString &, const StringVector &);
167165
static bool handleModule(yyscan_t yyscanner,const QCString &, const StringVector &);
168166

169-
#if USE_STATE2STRING
170-
static const char *stateToString(int state);
171-
#endif
167+
[[maybe_unused]] static const char *stateToString(int state);
172168

173169
typedef bool (*DocCmdFunc)(yyscan_t yyscanner,const QCString &name, const StringVector &optList);
174170

@@ -831,7 +827,7 @@ STopt [^\n@\\]*
831827
// the {B}* in the front was added for bug620924
832828
QCString fullMatch = QCString(yytext);
833829
int idx = fullMatch.find('{');
834-
/* handle `\f{` and `@f{` as special cases */
830+
/* handle `f{` command as special case */
835831
if ((idx > 1) && (yytext[idx-1] == 'f') && (yytext[idx-2] == '\\' || yytext[idx-2] =='@')) REJECT;
836832
int idxEnd = fullMatch.find("}",idx+1);
837833
QCString cmdName;
@@ -4217,6 +4213,4 @@ void CommentScanner::close(Entry *e,const QCString &fileName,int lineNr,bool fou
42174213
yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit);
42184214
}
42194215

4220-
#if USE_STATE2STRING
42214216
#include "commentscan.l.h"
4222-
#endif

src/configimpl.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@
5252
// For debugging
5353
#define SHOW_INCLUDES 0
5454

55-
#define USE_STATE2STRING 0
56-
57-
#if USE_STATE2STRING
58-
static const char *stateToString(int state);
59-
#endif
55+
[[maybe_unused]] static const char *stateToString(int state);
6056

6157
static const char *warning_str = "warning: ";
6258
static const char *error_str = "error: ";
@@ -2323,6 +2319,4 @@ void Config::deinit()
23232319
ConfigImpl::instance()->deleteInstance();
23242320
}
23252321

2326-
#if USE_STATE2STRING
23272322
#include "configimpl.l.h"
2328-
#endif

src/constexp.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@
3737
#define YY_NO_INPUT 1
3838
#define YY_NO_UNISTD_H 1
3939

40-
#define USE_STATE2STRING 0
41-
42-
#if USE_STATE2STRING
43-
static const char *stateToString(int state);
44-
#endif
40+
[[maybe_unused]] static const char *stateToString(int state);
4541

4642
static int yyread(char *buf,int max_size,yyscan_t yyscanner);
4743

@@ -170,6 +166,4 @@ extern "C" {
170166
int constexpYYwrap(yyscan_t /* yyscanner */) { return 1; }
171167
}
172168
173-
#if USE_STATE2STRING
174169
#include "constexp.l.h"
175-
#endif

src/declinfo.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ typedef yyguts_t *yyscan_t;
4848
#define YY_NO_UNISTD_H 1
4949
#define YY_NEVER_INTERACTIVE 1
5050

51-
#define USE_STATE2STRING 0
52-
5351
/* -----------------------------------------------------------------
5452
*
5553
* statics
@@ -74,9 +72,7 @@ struct declinfoYY_state
7472
bool insidePHP;
7573
};
7674

77-
#if USE_STATE2STRING
78-
static const char *stateToString(int state);
79-
#endif
75+
[[maybe_unused]] static const char *stateToString(int state);
8076

8177
static void addType(yyscan_t yyscanner);
8278
static void addTypeName(yyscan_t yyscanner);
@@ -419,6 +415,4 @@ int main()
419415
}
420416
#endif
421417

422-
#if USE_STATE2STRING
423418
#include "declinfo.l.h"
424-
#endif

src/defargs.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ typedef yyguts_t *yyscan_t;
7171
#define YY_NO_INPUT 1
7272
#define YY_NO_UNISTD_H 1
7373

74-
#define USE_STATE2STRING 0
75-
7674
/* -----------------------------------------------------------------
7775
* state variables
7876
*/
@@ -104,9 +102,7 @@ struct defargsYY_state
104102
QCString delimiter;
105103
};
106104

107-
#if USE_STATE2STRING
108-
static const char *stateToString(int state);
109-
#endif
105+
[[maybe_unused]] static const char *stateToString(int state);
110106

111107
static int yyread(yyscan_t yyscanner,char *buf,int max_size);
112108
static bool nameIsActuallyPartOfType(QCString &name);
@@ -841,6 +837,4 @@ std::unique_ptr<ArgumentList> stringToArgumentList(SrcLangExt lang, const QCStri
841837
return al;
842838
}
843839

844-
#if USE_STATE2STRING
845840
#include "defargs.l.h"
846-
#endif

src/doctokenizer.l

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ typedef yyguts_t *yyscan_t;
5151
#define YY_NO_INPUT 1
5252
#define YY_NO_UNISTD_H 1
5353

54-
#define USE_STATE2STRING 0
55-
5654
#define TK_COMMAND_SEL() (yytext[0] == '@' ? TK_COMMAND_AT : TK_COMMAND_BS)
5755

5856
//--------------------------------------------------------------------------
@@ -98,10 +96,7 @@ struct doctokenizerYY_state
9896
#define lineCount(s,len) do { for(int i=0;i<(int)len;i++) if (s[i]=='\n') yyextra->yyLineNr++; } while(0)
9997

10098

101-
#if USE_STATE2STRING
102-
static const char *stateToString(int state);
103-
#endif
104-
99+
[[maybe_unused]] static const char *stateToString(int state);
105100

106101
static int yyread(yyscan_t yyscanner,char *buf,int max_size);
107102
static void handleHtmlTag(yyscan_t yyscanner,const char *text);
@@ -2183,6 +2178,4 @@ int DocTokenizer::getLineNr(void)
21832178
return yyextra->yyLineNr;
21842179
}
21852180
2186-
#if USE_STATE2STRING
21872181
#include "doctokenizer.l.h"
2188-
#endif

src/fortrancode.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ typedef yyguts_t *yyscan_t;
7474
#define YY_NO_INPUT 1
7575
#define YY_NO_UNISTD_H 1
7676

77-
#define USE_STATE2STRING 0
78-
7977
/*
8078
* For fixed formatted code position 6 is of importance (continuation character).
8179
* The following variables and macros keep track of the column number
@@ -178,9 +176,7 @@ struct fortrancodeYY_state
178176
int fixedCommentAfter = 72;
179177
};
180178

181-
#if USE_STATE2STRING
182-
static const char *stateToString(int state);
183-
#endif
179+
[[maybe_unused]] static const char *stateToString(int state);
184180

185181
static bool getFortranNamespaceDefs(const QCString &mname,
186182
NamespaceDef *&cd);
@@ -1600,6 +1596,4 @@ static inline void pop_state(yyscan_t yyscanner)
16001596
}
16011597
//---------------------------------------------------------
16021598

1603-
#if USE_STATE2STRING
16041599
#include "fortrancode.l.h"
1605-
#endif

src/lexcode.l

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,6 @@ typedef yyguts_t *yyscan_t;
4646
#define YY_NO_INPUT 1
4747
#define YY_NO_UNISTD_H 1
4848

49-
#define USE_STATE2STRING 0
50-
5149
struct lexcodeYY_state
5250
{
5351
OutputCodeList *code;
@@ -93,9 +91,7 @@ struct lexcodeYY_state
9391
const char *currentFontClass;
9492
};
9593

96-
#if USE_STATE2STRING
97-
static const char *stateToString(int state);
98-
#endif
94+
[[maybe_unused]] static const char *stateToString(int state);
9995

10096
static void setCurrentDoc(yyscan_t yyscanner,const QCString &anchor);
10197
static void startCodeLine(yyscan_t yyscanner);
@@ -1284,6 +1280,4 @@ void LexCodeParser::parseCode(OutputCodeList &codeOutIntf,
12841280

12851281
//---------------------------------------------------------------------------------
12861282

1287-
#if USE_STATE2STRING
12881283
#include "lexcode.l.h"
1289-
#endif

0 commit comments

Comments
 (0)