summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-07-31 13:26:29 (GMT)
committeralbert-github <albert.tests@gmail.com>2020-07-31 13:26:29 (GMT)
commite0d293b8990381729593e123c351f905450686d3 (patch)
tree228a3dc55177a5960e2b30f39393c748b72559bb
parent0a09ab02f8ddbb4e3837b8b2611a2cf110b7e6f6 (diff)
downloadDoxygen-e0d293b8990381729593e123c351f905450686d3.zip
Doxygen-e0d293b8990381729593e123c351f905450686d3.tar.gz
Doxygen-e0d293b8990381729593e123c351f905450686d3.tar.bz2
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).
-rw-r--r--src/commentscan.l39
1 files changed, 25 insertions, 14 deletions
diff --git a/src/commentscan.l b/src/commentscan.l
index 5c49323..a1dd0e1 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -354,6 +354,7 @@ struct commentscanYY_state
{
OutlineParserInterface *langParser = 0; // the language parser that is calling us
QCString inputString; // input string
+ QCString currentCmd; // the command used
int inputPosition = 0; // read pointer
QCString fileName; // file name that is read from
int lineNr = 0; // line number in the input
@@ -1035,7 +1036,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
<ClassDocArg1,CategoryDocArg1>{DOCNL} {
warn(yyextra->fileName,yyextra->lineNr,
"missing argument after "
- "\\%s.",YY_START==ClassDocArg1?"class":"category"
+ "'\\%s'.",yyextra->currentCmd.data()
);
//addOutput(yyscanner,'\n');
//if (*yytext=='\n') yyextra->lineNr++;
@@ -1289,7 +1290,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
<RelatesParam1>{DOCNL} { // missing argument
warn(yyextra->fileName,yyextra->lineNr,
- "Missing argument of \\relates or \\memberof command"
+ "Missing argument of '\\%s' command",yyextra->currentCmd.data()
);
unput('\n');
//if (*yytext=='\n') yyextra->lineNr++;
@@ -1808,7 +1809,7 @@ RCSTAG "$"{ID}":"[^\n$]+"$"
}
<ExtendsParam>{DOCNL} { // missing argument
warn(yyextra->fileName,yyextra->lineNr,
- "\\extends or \\implements command has no argument"
+ "'\\%s' command has no argument",yyextra->currentCmd.data()
);
//if (*yytext=='\n') yyextra->lineNr++;
//addOutput(yyscanner,'\n');
@@ -1970,10 +1971,11 @@ static bool handlePackage(yyscan_t yyscanner,const QCString &, const QCStringLis
return stop;
}
-static bool handleClass(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleClass(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::CLASSDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
@@ -1985,50 +1987,56 @@ static bool handleHeaderFile(yyscan_t yyscanner,const QCString &, const QCString
return FALSE;
}
-static bool handleProtocol(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleProtocol(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{ // Obj-C protocol
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::PROTOCOLDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleCategory(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleCategory(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{ // Obj-C category
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::CATEGORYDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( CategoryDocArg1 );
return stop;
}
-static bool handleUnion(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleUnion(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::UNIONDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleStruct(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleStruct(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::STRUCTDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleInterface(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleInterface(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::INTERFACEDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
-static bool handleIdlException(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleIdlException(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
bool stop=makeStructuralIndicator(yyscanner,Entry::EXCEPTIONDOC_SEC);
+ yyextra->currentCmd = cmd;
BEGIN( ClassDocArg1 );
return stop;
}
@@ -2228,7 +2236,7 @@ static bool handleEndParBlock(yyscan_t yyscanner,const QCString &, const QCStrin
return FALSE;
}
-static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleRelated(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
@@ -2241,7 +2249,7 @@ static bool handleRelated(yyscan_t yyscanner,const QCString &, const QCStringLis
return FALSE;
}
-static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
@@ -2250,11 +2258,12 @@ static bool handleRelatedAlso(yyscan_t yyscanner,const QCString &, const QCStrin
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
yyextra->current->relatesType = Duplicate;
+ yyextra->currentCmd = cmd;
BEGIN(RelatesParam1);
return FALSE;
}
-static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleMemberOf(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
if (!yyextra->current->relates.isEmpty())
@@ -2263,6 +2272,7 @@ static bool handleMemberOf(yyscan_t yyscanner,const QCString &, const QCStringLi
"found multiple \\relates, \\relatesalso or \\memberof commands in a comment block, using last definition");
}
yyextra->current->relatesType = MemberOf;
+ yyextra->currentCmd = cmd;
BEGIN(RelatesParam1);
return FALSE;
}
@@ -2663,9 +2673,10 @@ static bool handleInherit(yyscan_t yyscanner,const QCString &, const QCStringLis
return FALSE;
}
-static bool handleExtends(yyscan_t yyscanner,const QCString &, const QCStringList &)
+static bool handleExtends(yyscan_t yyscanner,const QCString &cmd, const QCStringList &)
{
struct yyguts_t *yyg = (struct yyguts_t*)yyscanner;
+ yyextra->currentCmd = cmd;
BEGIN(ExtendsParam);
return FALSE;
}