breathe icon indicating copy to clipboard operation
breathe copied to clipboard

Supress duplicate declaration warning

Open tdegeus opened this issue 3 years ago • 1 comments

Hi! Great work on the library!!

I have a question. I want to have two sections in my docs, one which gives the details per function, and one which gives just an overview. E.g. I would like to have

.. doxygenfunction:: Foo::Bar
    :project: Foo

.. doxygennamespace:: Foo
   :project: Foo
   :content-only:
   :outline:
   :members:
   :protected-members:
   :private-members:
   :undoc-members:
   :no-link:

But this gives me

WARNING: Duplicate C++ declaration, also defined at ....
Declaration is '.. cpp:function:: Foo::Bar'.

Is there any way to avoid such a warning

tdegeus avatar Feb 08 '21 09:02 tdegeus

These Breathe directives declares the entities through the underlying Sphinx directives, and as the warning suggests, this should only be done once. For C and C++ I believe the no-link option does nothing (we should looks at getting it removed/redocumented/something). Instead, you can use the Sphinx directive cpp:alias and c:alias (https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-cpp-alias, https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#directive-c-alias). For now only the C version can recursively write a synopsis (the maxdepth option), but I am working on the same/similar functionality for the C++ version (see https://github.com/sphinx-doc/sphinx/issues/8213).

jakobandersen avatar Feb 08 '21 09:02 jakobandersen