Skip to content

Commit e0d293b

Browse files
committed
Misleading warning about missing argument
When having a `@struct` command without argument one gets the misleading warning: ``` warning: missing argument after \class. ``` instead of: ``` warning: missing argument after '\struct'. ``` This happens with a number of commands, for these commands the `currentCmd` has been introduced. (Found in cmake through Fossies).
1 parent 0a09ab0 commit e0d293b

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

src/commentscan.l

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ struct commentscanYY_state
354354
{
355355
OutlineParserInterface *langParser = 0; // the language parser that is calling us
356356
QCString inputString; // input string
357+
QCString currentCmd; // the command used
357358
int inputPosition = 0; // read pointer
358359
QCString fileName; // file name that is read from
359360
int lineNr = 0; // line number in the input
@@ -1035,7 +1036,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
10351036
<ClassDocArg1,CategoryDocArg1>{DOCNL} {
10361037
warn(yyextra->fileName,yyextra->lineNr,
10371038
"missing argument after "
1038-
"\\%s.",YY_START==ClassDocArg1?"class":"category"
1039+
"'\\%s'.",yyextra->currentCmd.data()
10391040
);
10401041
//addOutput(yyscanner,'\n');
10411042
//if (*yytext=='\n') yyextra->lineNr++;
@@ -1289,7 +1290,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
12891290
}
12901291
<RelatesParam1>{DOCNL} { // missing argument
12911292
warn(yyextra->fileName,yyextra->lineNr,
1292-
"Missing argument of \\relates or \\memberof command"
1293+
"Missing argument of '\\%s' command",yyextra->currentCmd.data()
12931294
);
12941295
unput('\n');
12951296
//if (*yytext=='\n') yyextra->lineNr++;
@@ -1808,7 +1809,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
18081809
}
18091810
<ExtendsParam>{DOCNL} { // missing argument
18101811
warn(yyextra->fileName,yyextra->lineNr,
1811-
"\\extends or \\implements command has no argument"
1812+
"'\\%s' command has no argument",yyextra->currentCmd.data()
18121813
);
18131814
//if (*yytext=='\n') yyextra->lineNr++;
18141815
//addOutput(yyscanner,'\n');
@@ -1970,10 +1971,11 @@ static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringLis
19701971
return stop;
19711972
}
19721973

1973-
static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &)
1974+
static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
19741975
{
19751976
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
19761977
bool stop=makeStructuralIndicator(yyscanner,Entry::CLASSDOC_SEC);
1978+
yyextra->currentCmd = cmd;
19771979
BEGIN( ClassDocArg1 );
19781980
return stop;
19791981
}
@@ -1985,50 +1987,56 @@ static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCString
19851987
return FALSE;
19861988
}
19871989

1988-
static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &)
1990+
static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
19891991
{ // Obj-C protocol
19901992
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
19911993
bool stop=makeStructuralIndicator(yyscanner,Entry::PROTOCOLDOC_SEC);
1994+
yyextra->currentCmd = cmd;
19921995
BEGIN( ClassDocArg1 );
19931996
return stop;
19941997
}
19951998

1996-
static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &)
1999+
static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
19972000
{ // Obj-C category
19982001
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
19992002
bool stop=makeStructuralIndicator(yyscanner,Entry::CATEGORYDOC_SEC);
2003+
yyextra->currentCmd = cmd;
20002004
BEGIN( CategoryDocArg1 );
20012005
return stop;
20022006
}
20032007

2004-
static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &)
2008+
static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
20052009
{
20062010
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
20072011
bool stop=makeStructuralIndicator(yyscanner,Entry::UNIONDOC_SEC);
2012+
yyextra->currentCmd = cmd;
20082013
BEGIN( ClassDocArg1 );
20092014
return stop;
20102015
}
20112016

2012-
static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &)
2017+
static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
20132018
{
20142019
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
20152020
bool stop=makeStructuralIndicator(yyscanner,Entry::STRUCTDOC_SEC);
2021+
yyextra->currentCmd = cmd;
20162022
BEGIN( ClassDocArg1 );
20172023
return stop;
20182024
}
20192025

2020-
static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &)
2026+
static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
20212027
{
20222028
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
20232029
bool stop=makeStructuralIndicator(yyscanner,Entry::INTERFACEDOC_SEC);
2030+
yyextra->currentCmd = cmd;
20242031
BEGIN( ClassDocArg1 );
20252032
return stop;
20262033
}
20272034

2028-
static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &)
2035+
static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
20292036
{
20302037
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
20312038
bool stop=makeStructuralIndicator(yyscanner,Entry::EXCEPTIONDOC_SEC);
2039+
yyextra->currentCmd = cmd;
20322040
BEGIN( ClassDocArg1 );
20332041
return stop;
20342042
}
@@ -2228,7 +2236,7 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin
22282236
return FALSE;
22292237
}
22302238

2231-
static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &)
2239+
static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
22322240
{
22332241
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
22342242
if (!yyextra->current->relates.isEmpty())
@@ -2241,7 +2249,7 @@ static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringLis
22412249
return FALSE;
22422250
}
22432251

2244-
static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &)
2252+
static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
22452253
{
22462254
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
22472255
if (!yyextra->current->relates.isEmpty())
@@ -2250,11 +2258,12 @@ static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStrin
22502258
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
22512259
}
22522260
yyextra->current->relatesType = Duplicate;
2261+
yyextra->currentCmd = cmd;
22532262
BEGIN(RelatesParam1);
22542263
return FALSE;
22552264
}
22562265

2257-
static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &)
2266+
static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
22582267
{
22592268
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
22602269
if (!yyextra->current->relates.isEmpty())
@@ -2263,6 +2272,7 @@ static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringLi
22632272
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
22642273
}
22652274
yyextra->current->relatesType = MemberOf;
2275+
yyextra->currentCmd = cmd;
22662276
BEGIN(RelatesParam1);
22672277
return FALSE;
22682278
}
@@ -2663,9 +2673,10 @@ static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringLis
26632673
return FALSE;
26642674
}
26652675

2666-
static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &)
2676+
static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
26672677
{
26682678
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
2679+
yyextra->currentCmd = cmd;
26692680
BEGIN(ExtendsParam);
26702681
return FALSE;
26712682
}

0 commit comments

Comments
 (0)