From 2428c5ad6d971793a2942a0cf08a4b2449a98551 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 21 Jan 2019 13:51:08 +0100 Subject: 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 --- src/docparser.cpp | 28 ++++++++++++++-------------- 1 file 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"); - } } } -- cgit v0.12