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

COMP: Fix the WDocumentation \struct warning for template struct #4662

Merged

Conversation

andrei-sandor
Copy link
Contributor

Remove \struct Doxygen keyword from template struct

@github-actions github-actions bot added type:Compiler Compiler support or related warnings area:Core Issues affecting the Core module labels May 14, 2024
@andrei-sandor
Copy link
Contributor Author

For this bug llvm/llvm-project#92023 related to clang, the solution is to remove the \struc Doxygen comment. Should this modification be performed each time that we have a template/struct combination?

@dzenanz dzenanz requested a review from jhlegarreta May 14, 2024 19:00
@seanm seanm marked this pull request as draft May 14, 2024 21:06
@N-Dekker
Copy link
Contributor

If removing the \struct does not affect the Doxygen output, it's fine by me to have them all removed.

@seanm
Copy link
Contributor

seanm commented May 15, 2024

If removing the \struct does not affect the Doxygen output, it's fine by me to have them all removed.

@dzenanz @jhlegarreta if no one else objects, we can make this change everywhere. It seems to be the only way to work around that clang -Wdocumentation bug, and it would be nice to get to zero -Wdocumentation warnings.

Comment on lines 57 to 58
/**
* \brief Templated class to produce a unique type "true" and "false".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You might as well merge those two lines of comment (line 57 and 58), once \struct BooleanDispatch is removed. As in:

  /** \brief Templated class to produce a unique type "true" and "false".

Just a suggestion!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I applied the suggestion. Thank you!

@jhlegarreta
Copy link
Member

@seanm I am not sure what is the right way to go, but Doxygen does have a struct command:
https://www.doxygen.nl/manual/commands.html#cmdstruct

So the underlying problem may be another one.

@seanm
Copy link
Contributor

seanm commented May 16, 2024

@jhlegarreta the issue is that clang's -Wdocumentation warning is triggered by this construct:

/** \struct BooleanDispatch
 * \brief Templated class to produce a unique type "true" and "false".
 *
 * BooleanDispatch is a templated class that produce a unique type for
 * for "true" and for "false".  These types may be used to decide which
 * version of an overloaded function to call.
 */
template <bool>
struct BooleanDispatch
{};

It warns:

structDoxygenFinal.cxx:3:5: warning: '@struct' command should not be used in a comment attached to a non-struct declaration [-Wdocumentation]
 * \struct BooleanDispatch
   ~^~~~~~~~~~~~~~~~~~~~~~

I think it's confused by the intermediate presence of the template keyword. It thinks you're trying to attach a \struct comment to a template, and so it warns. This warning is a false positive in our opinion. But it can be worked around by just removing the \struct since the comment is directly above the struct, it's redundant.

So far, this is the only false positive we've seen from -Wdocumentation, which has caught other nice things, so I'd like to enable it on CI.

@jhlegarreta
Copy link
Member

I will not oppose to it, but wondering if there is a way to tell clang -Wdocumentation to skip this particular line. And yes, enabling it in the CI would be great. Thanks Sean.

@seanm
Copy link
Contributor

seanm commented May 16, 2024

I will not oppose to it, but wondering if there is a way to tell clang -Wdocumentation to skip this particular line.

It could be wrapped with #pragma clang diagnostic ignored but that would be a major uglification. And @andrei-sandor's commit here is showing just one example so we could have this discussion, but there are dozens of instances of this pattern.

@jhlegarreta
Copy link
Member

OK, as said, will not oppose. It's been a while since I do not have enough bandwidth to contribute/review as I'd like to, so go ahead with all changes as required without waiting for me.

Remove \struct Doxygen keyword from template struct

Fix the others WDocumentation \struct warnings for template struct

Also, changed that \brief starts on /**
@seanm seanm marked this pull request as ready for review May 24, 2024 17:14
@seanm
Copy link
Contributor

seanm commented May 27, 2024

@dzenanz how do you kick a bot again?

@dzenanz
Copy link
Member

dzenanz commented May 27, 2024

/azp.run ITK.macOS.Arm64

@dzenanz
Copy link
Member

dzenanz commented May 27, 2024

/azp run ITK.macOS.Arm64

@dzenanz
Copy link
Member

dzenanz commented May 27, 2024

I don't think either of those "commands" worked. I kicked it off via GUI.

@seanm
Copy link
Contributor

seanm commented May 28, 2024

I don't think either of those "commands" worked. I kicked it off via GUI.

Where in the GUI can one do this? Or can you because you have admin privileges?

Anyway, I'm trying to tell what's failing on that macOS bot. I see one test "itkFFTConvolutionImageFilterStreamingTest" failing, is that the issue? Is that test known-flaky? This PR changes only comments, so I don't get why the test would fail...

@dzenanz
Copy link
Member

dzenanz commented May 28, 2024

Clicking on the Details link next to the failure takes me here:
Screenshot 2024-05-28 14 04 15
If I am not signed in I don't have the option to re-run the jobs.

@dzenanz
Copy link
Member

dzenanz commented May 28, 2024

@thewtex might comment on the failing test flaky-ness.

@seanm
Copy link
Contributor

seanm commented May 28, 2024

Ah, thanks for pointing out where that button is!

@thewtex
Copy link
Member

thewtex commented May 29, 2024

I am not familiar with the reported flakiness of itkFFTConvolutionImageFilterStreamingTest.

@seanm
Copy link
Contributor

seanm commented May 29, 2024

I am not familiar with the reported flakiness of itkFFTConvolutionImageFilterStreamingTest.

Hmm, well, re-runnning it for the 3rd time now has the CI green.

@seanm
Copy link
Contributor

seanm commented May 30, 2024

This looks ready to merge to me.

Copy link
Member

@thewtex thewtex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@thewtex thewtex merged commit e190552 into InsightSoftwareConsortium:master May 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module type:Compiler Compiler support or related warnings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants