breathe-doc / breathe

ReStructuredText and Sphinx bridge to Doxygen
https://breathe-doc.org
Other
751 stars 198 forks source link

doxygenfunction: Cannot find function "" when declared in C file #786

Open jaenrig-ifx opened 2 years ago

jaenrig-ifx commented 2 years ago

Hi there,

I have an using sphinx + breathe + exhale, in a C project with basically 2 files:

I don´t find a way to get the .c functions declared as static to be properly generated in the documentation. They always throw the same warning:

WARNING: doxygenfunction: Cannot find function "functionxxx" in doxygen xml output for project "myProject" from directory: build/xml/

The native doxygen html documentation is properly showing these functions when EXTRACT_STATIC is set to YES for doxygen. The xml has those functions present. I have tried the following configuration as well in the conf.py:

breathe_domain_by_extension = {
        "h" : "c"
        }

The toolchain versions :

Any idea how to get that running?

Thanks!

jakobandersen commented 2 years ago

Is the project publicly available to get concrete in where the issue may be? And if so, do you have instructions for how to reproduce the problem. Otherwise, can you provide a minimum example project which reproduces the problem?

Knaifhogg commented 2 years ago

Somewhat edited but the gist of it:

file.c

static void foo(UByte bar);

/*!
    foo

    \param bar this is bar
*/

static void foo(UByte bar)
{
    return bar;
}

Doxyfile

EXTRACT_ALL            = YES
EXTRACT_STATIC         = YES

doxygen bild

docs.rst

.. doxygenfunction:: foo
   :project: auto-nail-mcu

result

Warning, treated as error: path\to\docs.rst:13:doxygenfunction: Cannot find function "foo" in doxygen xml output for project "temp" from directory: ../doxygen/xml/

the xml file

<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.5" xml:lang="en-US">
  <compounddef id="file_8c" kind="file" language="C++">
    <compoundname>file.c</compoundname>
      <sectiondef kind="func">
      <memberdef kind="function" id="file_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" prot="public" static="yes" const="no" explicit="no" inline="no" virt="non-virtual">
        <type>void</type>
        <definition>static void foo</definition>
        <argsstring>(UByte bar)</argsstring>
        <name>foo</name>
        <param>
          <type>UByte</type>
          <declname>bar</declname>
        </param>
        <briefdescription>
        </briefdescription>
        <detaileddescription>
<para>foo</para>
<para><parameterlist kind="param"><parameteritem>
<parameternamelist>
<parametername>bar</parametername>
</parameternamelist>
<parameterdescription>
<para>this is bar </para>
</parameterdescription>
</parameteritem>
</parameterlist>
</para>
        </detaileddescription>
        <inbodydescription>
        </inbodydescription>
        <location file="file.c" line="10" column="13" bodyfile="file.c" bodystart="10" bodyend="13" declfile="file.c" declline="1" declcolumn="13"/>
      </memberdef>
      </sectiondef>
    <briefdescription>
    </briefdescription>
    <detaileddescription>
    </detaileddescription>
    <programlisting>
<codeline lineno="1"><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="gem__app_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" kindref="member">foo</ref>(UByte<sp/>bar);</highlight></codeline>
<codeline lineno="2"><highlight class="normal"></highlight></codeline>
<codeline lineno="3"><highlight class="normal"></highlight></codeline>
<codeline lineno="10"><highlight class="normal"></highlight><highlight class="keyword">static</highlight><highlight class="normal"><sp/></highlight><highlight class="keywordtype">void</highlight><highlight class="normal"><sp/><ref refid="gem__app_8c_1a7f01d41bafbbd6b4a78ff0408cbd0ef0" kindref="member">foo</ref>(UByte<sp/>bar)</highlight></codeline>
<codeline lineno="11"><highlight class="normal">{</highlight></codeline>
<codeline lineno="12"><highlight class="normal"><sp/><sp/><sp/><sp/></highlight><highlight class="keywordflow">return</highlight><highlight class="normal"><sp/>bar;</highlight></codeline>
<codeline lineno="13"><highlight class="normal">}</highlight></codeline>
    </programlisting>
    <location file="file.c"/>
  </compounddef>
</doxygen>
schlatterbeck commented 1 year ago

Have you set

EXTRACT_STATIC = YES

in your Doxygen config?

smitchell7 commented 1 year ago

The construct of how Breathe expects to use C++ files with classes, not C-style where you might have static functions defined internal to the implementation file.

To include both, you need to set the variable: breathe_implementation_filename_extensions to include your c file, but it can make the system angry.

daltonv commented 11 months ago

Does this mean there is no way to document static functions in a *.c file with breathe?