summaryrefslogtreecommitdiffstats
path: root/src/docparser.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2019-01-21 12:51:08 (GMT)
committeralbert-github <albert.tests@gmail.com>2019-01-21 12:51:08 (GMT)
commit2428c5ad6d971793a2942a0cf08a4b2449a98551 (patch)
tree09420fee16a5ccf3ab2bb8cd24642a0679496884 /src/docparser.cpp
parentfa28a4a9e53ba87035666680295273f36b237e19 (diff)
downloadDoxygen-2428c5ad6d971793a2942a0cf08a4b2449a98551.zip
Doxygen-2428c5ad6d971793a2942a0cf08a4b2449a98551.tar.gz
Doxygen-2428c5ad6d971793a2942a0cf08a4b2449a98551.tar.bz2
Warning for documented return of void type function
In case a void type function is documented it is not allowed to used a `\return` or `\retval` command. The test was present but not correct - test on `g_hasReturnCommand ` which signals whether of not `\ret...` is used instead of `g_memberDef->hasDocumentedReturnType()` - removed test on emty return type (empty return type is assumed to be non void, see e.g. C, Fortran). - order of the tests is important
Diffstat (limited to 'src/docparser.cpp')
-rw-r--r--src/docparser.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp
index 20ee1f0..4b1ce94 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -616,16 +616,28 @@ static void detectNoDocumentedParams()
g_memberDef->setHasDocumentedParams(TRUE);
}
}
- //printf("Member %s hadDocumentedReturnType()=%d hasReturnCommand=%d\n",
+ //printf("Member %s hasDocumentedReturnType()=%d hasReturnCommand=%d\n",
// g_memberDef->name().data(),g_memberDef->hasDocumentedReturnType(),g_hasReturnCommand);
if (!g_memberDef->hasDocumentedReturnType() && // docs not yet found
g_hasReturnCommand)
{
g_memberDef->setHasDocumentedReturnType(TRUE);
}
+ else if ( // see if return type is documented in a function w/o return type
+ g_hasReturnCommand &&
+ (//returnType.isEmpty() || // empty return type
+ returnType.find("void")!=-1 || // void return type
+ returnType.find("subroutine")!=-1 || // fortran subroutine
+ g_memberDef->isConstructor() || // a constructor
+ g_memberDef->isDestructor() // or destructor
+ )
+ )
+ {
+ warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type of %s",g_memberDef->qualifiedName().data());
+ }
else if ( // see if return needs to documented
g_memberDef->hasDocumentedReturnType() ||
- returnType.isEmpty() || // empty return type
+ //returnType.isEmpty() || // empty return type
returnType.find("void")!=-1 || // void return type
returnType.find("subroutine")!=-1 || // fortran subroutine
g_memberDef->isConstructor() || // a constructor
@@ -634,18 +646,6 @@ static void detectNoDocumentedParams()
{
g_memberDef->setHasDocumentedReturnType(TRUE);
}
- else if ( // see if return type is documented in a function w/o return type
- g_memberDef->hasDocumentedReturnType() &&
- (returnType.isEmpty() || // empty return type
- returnType.find("void")!=-1 || // void return type
- returnType.find("subroutine")!=-1 || // fortran subroutine
- g_memberDef->isConstructor() || // a constructor
- g_memberDef->isDestructor() // or destructor
- )
- )
- {
- warn_doc_error(g_fileName,doctokenizerYYlineno,"documented empty return type");
- }
}
}