diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2018-04-22 09:23:56 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-22 09:23:56 (GMT) |
commit | 3cf47f9adda4b72a61910869de80f7e5606d8099 (patch) | |
tree | ad34983ca937d12d6e3cacb66bb27c4681dad8d1 /src | |
parent | 32068852efb6cb767efd5a09e0b02eda2f3dfae8 (diff) | |
parent | d39cdf826f15470def2ca36bc636868a62c42bbf (diff) | |
download | Doxygen-3cf47f9adda4b72a61910869de80f7e5606d8099.zip Doxygen-3cf47f9adda4b72a61910869de80f7e5606d8099.tar.gz Doxygen-3cf47f9adda4b72a61910869de80f7e5606d8099.tar.bz2 |
Merge pull request #669 from albert-github/feature/bug_793862
Bug 793862 - Missed warning opportunity: duplicated arguments
Diffstat (limited to 'src')
-rw-r--r-- | src/docparser.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index 3d57c2e..0257a1e 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -451,11 +451,12 @@ static void checkArgumentName(const QCString &name,bool isParam) } /*! Checks if the parameters that have been specified using \@param are - * indeed all parameters. + * indeed all parameters and that a parameter does not have multiple + * \@param blocks. * Must be called after checkArgumentName() has been called for each * argument. */ -static void checkUndocumentedParams() +static void checkUnOrMultipleDocumentedParams() { if (g_memberDef && g_hasParamCommand && Config_getBool(WARN_IF_DOC_ERROR)) { @@ -470,18 +471,37 @@ static void checkUndocumentedParams() bool found=FALSE; for (ali.toFirst();(a=ali.current());++ali) { + int count = 0; QCString argName = g_memberDef->isDefine() ? a->type : a->name; if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); + QCString aName = argName; if (argName.right(3)=="...") argName=argName.left(argName.length()-3); - if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) + if (lang==SrcLangExt_Python && (argName=="self" || argName=="cls")) { // allow undocumented self / cls parameter for Python } else if (!argName.isEmpty() && g_paramsFound.find(argName)==0 && a->docs.isEmpty()) { found = TRUE; - break; + } + else + { + QDictIterator<void> it1(g_paramsFound); + void *item1; + for (;(item1=it1.current());++it1) + { + if (argName == it1.currentKey()) count++; + } + } + if (count > 1) + { + warn_doc_error(g_memberDef->getDefFileName(), + g_memberDef->getDefLine(), + "argument '" + aName + + "' from the argument list of " + + QCString(g_memberDef->qualifiedName()) + + " has muliple @param documentation sections"); } } if (found) @@ -497,7 +517,7 @@ static void checkUndocumentedParams() QCString argName = g_memberDef->isDefine() ? a->type : a->name; if (lang==SrcLangExt_Fortran) argName = argName.lower(); argName=argName.stripWhiteSpace(); - if (g_memberDef->getLanguage()==SrcLangExt_Python && (argName=="self" || argName=="cls")) + if (lang==SrcLangExt_Python && (argName=="self" || argName=="cls")) { // allow undocumented self / cls parameter for Python } @@ -7541,7 +7561,7 @@ DocRoot *validatingParseDoc(const char *fileName,int startLine, delete v; } - checkUndocumentedParams(); + checkUnOrMultipleDocumentedParams(); detectNoDocumentedParams(); // TODO: These should be called at the end of the program. |