Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Warning for void-return with C typedefs? #8919

Open
traud opened this issue Nov 27, 2021 · 4 comments
Open

Feature request: Warning for void-return with C typedefs? #8919

traud opened this issue Nov 27, 2021 · 4 comments
Labels
enhancement a request to enhance doxygen, not a bug

Comments

@traud
Copy link

traud commented Nov 27, 2021

Some projects do not allow a Feature Request without Pull Request, however, I am not absolutely sure whether this is not a bug. Could even be a misconfiguration, however, I do not see why. Anyway, commit 2428c5a fixed the warning for void functions but have a \return or \retval documentation. That is very handy to find wrongly documented functions, mostly copy-and-paste errors. However, in ‘my’ current project, its authors used statements like \return Nothing over two decades. Consequently, commit 2428c5a introduced zillion of warnings. After fixing all of them, I found three code constructs which do not trigger that return-void warning by Doxygen – and I wonder why:

#include <stdio.h>

/*! \brief A structure with one member */
struct my_struct {
	/*!
	 * \brief A callback function
	 * \retval 0 Always
	 */
	void (*my_callback_1)(void);
};

/*!
 * \brief Another callback function
 * \retval 0 Always
 */
typedef void (*my_callback_2)(void);

/*!
 * \brief Hello World!
 * \retval 0 Always
 */
static void hello_1() {
	puts("Hello World!");
}

/*!
 * \brief Hello World!
 * \retval 0 Always
 */
#define hello_2() hello_1()

/*!
 * \brief Main function
 * \retval 0 Always
 */
int main(void) {
	struct my_struct;
	hello_2();
	return 0;
}

I understand that hello_1 triggers that warning only with EXTRACT_STATIC=YES and that requires EXTRACT_ALL=YES. However, the other three constructs show a return value in the resulting HTML documentation but do not create a warning. I used the following Doxyfile:

EXTRACT_ALL      = YES
WARN_NO_PARAMDOC = YES
WARN_AS_ERROR    = YES

Because the code constructs are in the HTML documentation, I do not think, I have a configuration error. Anyway, please, correct me if I am wrong. Anyway, anyway, I am very delighted about the current return-void warning. Perhaps it can be extended so it also catches those three cases.

Version
1.9.1 on Ubuntu 21.10, re-tested with current binary release (1.9.2)

@albert-github
Copy link
Collaborator

You wrote:

I understand that hello_1 triggers that warning only with EXTRACT_STATIC=YES and that requires EXTRACT_ALL=YES.

this is not correct EXTRACT_STATIC=YES does not require EXTRACT_ALL=YES.

@albert-github albert-github added the enhancement a request to enhance doxygen, not a bug label Nov 27, 2021
@traud
Copy link
Author

traud commented Nov 27, 2021

Interesting. I just re-tested it and I have to enable both EXTRACT_ALL and EXTRACT_STATIC to get the warning for hello_1. If one of them is disabled, Doxygen just passes (and hello_1 is not shown in the resulting HTML at all). Versions/builds as mentioned. Are you able to trigger that warning with some custom build or with a different configuration set? That WARN_NO_PARAMDOC is still required because of my other issue. Is that somehow related, or is this yet another issue?

Or are you saying my statement is not correct in general, because EXTRACT_STATIC alone extracts some statics just not this one here? Then, I am confused. Why not this one?

@albert-github
Copy link
Collaborator

I can reproduce your problem by using the original setup and setting EXTRACT_STATIC=YES but without WARN_AS_ERROR = YES. The fact that I didn't see the problem was that I wrote /// \file in the first line to be sure the file is processed (there are some circumstances where doxygen doesn't see the content of a file as the file itself is not documented, but in this way the file is seen).

EXTRACT_ALL is there for getting also undocumented entities and this also applies to files.

@traud
Copy link
Author

traud commented Nov 28, 2021

Interesting. Thanks for clarifying. The file was parsed and my_struct was extracted. However, the file itself was not documented (with the default EXTRACT_ALL=NO) and therefore no warning. In other words, EXTRACT_ALL=YES was required to trigger the documentation of the file and that triggered the documentation of hello_1 (because of EXTRACT_STATIC=YES).

With a correct documentation of the file itself, EXTRACT_ALL=YES is not required anymore. Got it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement a request to enhance doxygen, not a bug
Projects
None yet
Development

No branches or pull requests

2 participants