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

"WARNING: Duplicate declaration" for enum class members #470

Closed
nicoddemus opened this issue Jan 10, 2020 · 3 comments · Fixed by #512
Closed

"WARNING: Duplicate declaration" for enum class members #470

nicoddemus opened this issue Jan 10, 2020 · 3 comments · Fixed by #512
Assignees
Labels
bug Problem in existing code code Source code

Comments

@nicoddemus
Copy link

Hi!

First of all thanks for the project, makes writing C++ documentation a breeze!

I'm getting these warning messages when building my project:

...\sourpre\docs\enums.rst:8: WARNING: Duplicate declaration, sourpre::END
...\sourpre\docs\enums.rst:10: WARNING: Duplicate declaration, sourpre::END

Here are the relevant enums:

enum class GridStaticProperty
{
    ...
    /*! Internal. */
    END,
};

enum class WellTransientProperty
{
    ...
    /*! Internal. */
    END,
};

As can be seen, there are multiple END declarations, but I'm using enum classes, which makes the members semantically different and type-safe, so they are not really duplicate.

My question is: should breathe understand that those are enum classes and do not generate duplicate declarations?

If not, does anybody know a way to ignore the warnings? I ask because I like to turn warnings into errors in sphinx-build to catch errors, and having this false-positive warnings prevents me from doing that.

@jakobandersen
Copy link
Collaborator

My best guess is that this is actually a problem related to #356. Sphinx should handle scoped enums, but I'm not sure what Breathe sends to it. If you make an archive available with a small'ish reproducible example I can try to check.

@nicoddemus
Copy link
Author

Thanks @jakobandersen for the quick answer.

I've created a repository reproducing the issue:

https://github.com/nicoddemus/sphinx-breath-dup-issue

Unfortunately it doesn't seem like Doxygen is generating enough information for breathe to work with (removed the empty tags for readability):

<memberdef kind="enum" id="foo_8hpp_1ad62e57bc2f353e6d34f90be57ccd7e68" prot="public" static="no" strong="yes">
  <name>Enum1</name>
  <enumvalue id="foo_8hpp_1ad62e57bc2f353e6d34f90be57ccd7e68a02129bb861061d1a052c592e2dc6b383" prot="public">
    <name>X</name>
  </enumvalue>
  <enumvalue id="foo_8hpp_1ad62e57bc2f353e6d34f90be57ccd7e68ab1a326c06d88bf042f73d70f50197905" prot="public">
    <name>END</name>
  </enumvalue>
  <location file="foo.hpp" line="3" column="17" bodyfile="foo.hpp" bodystart="3" bodyend="6"/>
</memberdef>

(Unless strong="yes" means strongly typed? Doubt it though)

vermeeren added a commit that referenced this issue May 1, 2020
@vermeeren vermeeren self-assigned this May 1, 2020
@vermeeren vermeeren added bug Problem in existing code code Source code labels May 1, 2020
@vermeeren
Copy link
Collaborator

Should be fixed with #512, released in Breathe v4.17.0. Note that you also need Sphinx 3.x for recent Breathe versions.

@vermeeren vermeeren linked a pull request Dec 3, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Problem in existing code code Source code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants